Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 1,301 through 1,325 (of 1,585 total)
  • @boonebgorges

    Keymaster

    Seems to me that good practice for admin panels is to add them either under Site Admin, Site Admin > Options, or BuddyPress. That way the current_user_can/is_site_admin provisioning is already done for you.

    @boonebgorges

    Keymaster

    Oh. You might try changing this line

    if ( (int)get_blog_option( $blog['blog_id'], 'blog_public' ) ) {

    to

    if ( (int)get_option( 'blog_public' ) ) {

    Again, untested.

    @boonebgorges

    Keymaster

    Check out the last part of bp-core/bp-core-templatetags.php. There’s a bajillion listed there.

    @boonebgorges

    Keymaster

    @boonebgorges

    Keymaster

    Unfortunately I don’t have time right now to update the import plugin for single WP. But *I think* it should work with just a simple fix.

    In brief, the plugin loops through all the blogs on an MU install and then loops through all posts on that install. You should just need to remove the outer loop. There’s a block of code starting around line 34 in bp-import-blog-activity-bp-functions.php that says

    $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ";

    Remove the block of code that starts with that line and ends with

    switch_to_blog( $blog['blog_id'] );

    Make sure you leave the query_posts(‘order=ASC’); – that code should work with regular WP.

    Further down in that same file, find and remove

    restore_current_blog();

    }

    Make sure you remove that bracket (which closes the foreach loop).

    This is untested, but it should work in theory. Always do backups first!!!

    @boonebgorges

    Keymaster

    @3sixty’s solution is a good one.

    As for the question of how to get the user id, it really depends on exactly where you’re trying to pull it up. It sounds like in this case you want the user id for the last poster in a topic, so you should go to the template that controls the forum loop (bp-themes/bp-default/forums/forums-loop.php and see what’s being used to pull up the last poster’s name. In this case it’s bp_the_topic_last_poster_name. So go looking for that function. Usually if a function is referenced in a template file, it’s in the corresponding component -templatetags.php file; in this case, it’s buddypress/bp-forums/bp-forums-templatetags.php. If you look at the definition for bp_the_topic_last_poster_name, you can see that it’s getting its information from the global $forum_template that happens in the forum loop. Use print_r to print that global to your screen, and look for the ID that you’ll need.

    @boonebgorges

    Keymaster

    crashutah –

    – I will try to get around the FB Connect issue. I glanced at the code to see if I could understand the problem and I didn’t see it right away, though it’s more than likely the case (as you suggest) that FB Connect is not making full-fledged BuddyPress members (as opposed to the less fleshed-out WP users).

    – I’m planning on making the group send invites tab visibility more fine grained, so sitewide admins can choose who will get to see it.

    – Not sure I agree with you about people being used to comma-delimited fields – I can see my users getting terrified of such a phrase! Part of the reason for having separate fields is to prevent spam. It’d be easy enough to limit the number of permitted invitations with a comma-delimited list, but having separate fields makes it visually clear that you can only send a few at a time. On the back end, at some point in the future I will add the hooks and filters necessary to allow for address-book importing – the way the front end appears doesn’t really affect this functionality, as it all ends up getting stored as an array anyway.

    @boonebgorges

    Keymaster

    Hi everyone,

    I just checked in a trunk version with a bunch of fixes and new stuff. From the readme:

    * Enabled Opt Out option for invitees

    * Subject line is now customizable by the admin

    * Admin can toggle whether users can customize subject line and message body of invitation emails

    * Some localization bugs fixed

    * Filtered spammers from group invitation list

    * Fixed bug that may have caused problems with some MU limited email domain lists

    * Email Address field is now auto-populated on Accept Invitation screen

    If anyone feels like being an Outstanding Citizen and helping me out, they’re more than welcome to grab the development version https://wordpress.org/extend/plugins/invite-anyone/download/, deactivate and move their current version of the plugin, activate the dev version, and put it through the paces. I’m especially concerned to hear whether the opt-out feature works in the way that you’d expect.

    In reply to: Site wide stats?

    @boonebgorges

    Keymaster

    It’ll work on any theme that has the line

    <?php do_action( 'wp_footer' ) ?>

    Any decently written theme will have this line. I have come across very few that don’t.

    @boonebgorges

    Keymaster

    See if this does what you want. Put the following function in [your-theme]/functions.php or [plugin-dir]/bp-custom.php:

    function get_activity_count_by_user( $user_id ) {
    $args = array(
    'per_page' => 10000,
    'show_hidden' => true,
    'user_id' => $user_id
    );

    if ( bp_has_activities( $args ) ) {
    global $activities_template;
    $count = $activities_template->total_activity_count;
    } else {
    $count = 0;
    }

    return $count;
    }

    Then call the function somewhere in a template, something like this:

    <?php echo get_activity_count_by_user( $user_id ) ?>

    making sure that $user_id is populated with the user_id of the person you are querying about.

    You could filter this in various ways. To get just one kind of content, or content from just one component of the site, try some of the filters here: https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/. To exclude things (like anything having to do with blogs) is a bit tricker; after calling the $activities_template global, loop through each member of $activities_template->activities and check to see whether it’s the kind of thing you want. If not, reduce $activities_template->total_activity_count by one.

    @boonebgorges

    Keymaster

    crashutah – Thanks a million for the feedback. The Facebook language is really helpful. I think I should be able to add an opt-out feature with only a little work.

    As for your other excellent suggestions:

    – Definitely agree about customizing the subject. My plan was to make it customizable by the site admin, but not by the end user – but on second thought it would be easy enough to put a toggle on the back end that lets the site admin decide whether users can personalize the subject line

    – The Reply To idea is very good. I’m using wp_mail, WP’s built in mail function, which in theory should allow me to feed in some headers. I will give it a try – but no promises on this one, as I’ve had trouble making the WP default reply-to address work correctly in the past and don’t feel like tearing any more hair out over it :)

    – Something must have gotten screwed up in your apostrophe comment. Do you mean that a slash showed up? I suppose that makes sense. I will have a look at stripping those slashes.

    – Great, great idea about autopopulating email field. I will take care of it right away.

    – Your point about auto-adding/auto-friending is well-taken. I kind of feel the same way. I think I might make it an admin option: send group/friend invites, or just do the adding. I can see arguments both ways (you give a good case for auto-adding, but you might also think that it’s nice to get some notifications first thing when you log in…) so I think it might be best left as an option for the administrator.

    Again, I really appreciate the detailed feedback.

    In reply to: Site wide stats?

    @boonebgorges

    Keymaster

    Yup, that code will add an arbitrary piece of code into the footer, just before the </body> tag.

    In reply to: Site wide stats?

    @boonebgorges

    Keymaster
    function here_are_my_stats() {
    ?>
    // Put your statcounter/google analytics/whatever javascript code here
    <?php
    }
    add_action( 'wp_footer', 'here_are_my_stats', 999 );

    Put it in a PHP file and drop into mu-plugins.

    If you use Google Analytics, you can filter by subdomains: http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55524

    @boonebgorges

    Keymaster

    There are two options. One is to hook a function to bp_blogs_new_blog_post that takes the post content and uses bp_activity_update_meta to add the category to the activity meta table. Then you’d have to build a function that does something like what you want in_category to do, which would work by using bp_activity_get_meta to get the category that you recorded when the blog post was saved.

    The other option is to hook a filter to bp_has_activites, which would loop through all of the returned activities, identify the new blog posts by the activity action, and when it found one, load the entire blog post in order to get the categories. In order to load the blog post, you’d probably have to switch_to_blog and then use get_post. This is really database intensive and should probably be avoided – the first option is probably the best (though it won’t be retroactive).

    @boonebgorges

    Keymaster

    I think Andy is assuming that you want Friends to be the default view for every kind of activity stream. If you change it in activity-loop.php, it’ll change for every instance of the activity stream. There’s no need to have different versions of activity-loop.php for different sections of the site, as bp_has_activities already does the work of figuring out which page you’re on.

    If you only want to default to the Friends view on certain pages, you could put in some conditional logic. Call the global $bp in your template and look for $bp->current_component, $bp->current_action, $bp->action_variables. Use these to sniff out which page you’re on, and use some if-statements so that you only add the ‘&scope=friends’ argument on pages where you want the default to be ‘friends’.

    @boonebgorges

    Keymaster

    Ha ha, we were writing at the same time :)

    @boonebgorges

    Keymaster

    @gabrielcrowe Have you dumped the whole $_POST variable to see what it looks like when bp_activity_posted_update fires? Is it totally empty, or are you just failing to populate $_POST[‘trackstr’]?

    My guess is that it’s an AJAX issue. Activity updates are handled near the top of bp-default/_inc/global.js. The reason it’s not getting written to $_POST is because it’s not being submitted as a form at all. I’m not really that great with jQuery, but I think you might have to unbind the bp-default handler for input#aw-whats-new-submit, then reproduce that javascript in your own plugin, with additional code to grab the content of your track box and submit it to your custom function.

    @boonebgorges

    Keymaster

    Not sure why I included the $b in there in the first place. Try either removing it so you only have ( $a ) or changing it so that the arguments are ( $a, $b = false ).

    @boonebgorges

    Keymaster

    You should do the same thing to any tables that contain foreign characters in your database. That’ll probably include most if not all the tables beginning wp_bp_.

    @boonebgorges

    Keymaster

    @boonebgorges

    Keymaster

    Jeff, you rule. I feel like I learned a lot about WordPress by reading your posts in this thread!

    @boonebgorges

    Keymaster

    Urrrrrrrgh. Once again, I had failed to do my code merge correctly. I managed not to include the fix in 0.4.1. I just uploaded a proper version, so if you want the fix, just download version 0.4.1 again. I don’t want to tag another version just for this mess up on my part. I will tag a new version in the next day or two when I add some of the other suggestions I’ve gotten in this thread and elsewhere. Sorry about the idiocy on my part.

    @boonebgorges

    Keymaster

    Great idea Greg! It’s easy to do and I will put it in the next version.

    @boonebgorges

    Keymaster

    Thanks for your thoughtful comments. crashutah is right that some information will have to be written to the database. I think it would as simple as adding a column to the table already created by the plugin, something like is_opt_out. Any information about legal stuff would be really helpful as I go forth.

    I just checked in version 0.4.1, which should fix both the other-peoples-profile problem and the WP single problems that Anton mentions.

    @boonebgorges

    Keymaster

    @3sixty – Yes, I am aware of this Achilles’s heel, and I have toyed with a solution like yours.

    It would be really nice if bp_has_activities (and bp_has_members, etc) had some sort of exclude or exclude_by argument. I might try writing a realistic patch for the core that would make something like this more than just a hack.

Viewing 25 replies - 1,301 through 1,325 (of 1,585 total)
Skip to toolbar