Forum Replies Created
-
In reply to: Change slug without touching core files?
Hi @danbp,
Sorry I think i may have confused my explanation or something and got lost in translation :s.
Yeah I’m aware of the difference between the slugs used in the URL/permalinks and the menu/tab names. I’ve already updated the names etc in the PO files useing Poedit. But for one reason or another the:
define ( ‘BP_FRIENDS_SLUG’, ‘whatever’ );isn’t working…In reply to: Some basic Questions before installing BuddyPress.Hi, this might answer some of your q’s:
In reply to: Move member search barhttp://cssreset.com/understanding-css-relative-and-absolute-positioning-explained/
This might be useful to you @jonny5ive7
In reply to: Remove Everything GravatarThanks @henrywright! I’ll stick with
add_filter('bp_core_fetch_avatar_no_grav', '__return_true');then if it’s all I need to stop the Buddypress calls. What is it that WordPress calls for? Are you referring to the default ‘white figure on grey background’? Or does WordPress also check for a Gravatar in similar way to Buddypress. (I don’t currently use Gravatar).Hi @djsteveb , I came across some of those posts you listed which is actually what got me thinking about it in the first place :). I’m trying to be as transparent as possible on user privacy/data on the site I’m creating. Searched the forums a little further and some of the threads are v old so thought I’d check if the stuff there was still applicable or had been deprecated.
Hi @danbp, thanks for the plugin suggestions. I’ve come across a few Buddydev plugins and will probably use their ‘bp-activity-comment-notifier’ plugin since they aren’t part of Buddypress default currently. Trying to keep plugins to a minimum early on.
With regards to the ‘bp-avatar-suggestions’ plugin (which you appear to have inspired), does that override any WordPress calls Henry mentioned above since you are using your own locally stored images? (similar I guess to the new user Twitter eggs)?In reply to: Login redirect not excluding admin@henrywright. I raised the priority to 999 and went one step further by creating a new bp_functions php to put it in by itself (and put the original in another location). Didn’t make any difference. All users still directed to the stated page.
Anyway don’t waste your time on it, I appreciate the input. It’s not a huge deal. Was just a little confused as I haven’t seen anyone else on the forums have the same issue, which suggests that if the code is correct then there’s something else going on locally within my setup. Might reveal itself in time!
In reply to: Login redirect not excluding adminHi @danbp,
My code for hiding the admin bar already works, but thanks anyway. I was just giving Henry an example of another function where the
is_super_admin()was working. It was the earlier function in this thread (re. login redirect) where it wasn’t having an effect and all users were being directed to the link, without excluding the admin user.Cheers
In reply to: Login redirect not excluding adminI’ve set up two users to test various things on site during development, one with Administrator and one with Subscriber roles. That’s what the wp dash is confirming under users.
I also have another function to hide the wp admin bar at the top of the page which includes the is_super_admin(). When its active, the admin bar is removed for the subscriber but not the admin user as intended. So can only assume that there is a problem with my redirect function itself or perhaps its clashing with something else (though I have no other plugins atm).
//Remove wordpress admin bar for all except admin function bpmc_remove_admin_bar() { if( !is_super_admin() ) add_filter( 'show_admin_bar', '__return_false' ); } add_action('wp', 'bpmc_remove_admin_bar');In reply to: Login redirect not excluding adminAhh that’s interesting. Read the
is_super_admin()function codex page and assumed from what it said thatis_admin()did essentially the same thing.Anyway tried your suggestion of moving
return $redirect_toout of the braces but nothing changed. Also removed the braces altogether (as below) and no change. (Tried with the super_admin() in there too.)//Redirect all users except admin to Activity page when login button pressed function bpmc_redirect_login( $redirect_to, $set_for, $user ) { if( ! current_user_can('manage_options') ) $redirect_to = bp_core_get_user_domain($user->id) . 'activity/'; return $redirect_to; } add_filter('login_redirect', 'bpmc_redirect_login', 11, 3);In reply to: Login redirect not excluding adminp.s. the site im working on (offline), isn’t part of a multisite setup. Network mode should be off by default right (and therefore the
!is_super_admin()should do the same job as!is_admin())?In reply to: Login redirect not excluding adminHi @henrywright,
Thanks for reply. Switched the super_admin for your suggestion and no difference unfortunately.
In reply to: User favorites and user mentions feed / loopThanks @danbp, adding the scope and uncommenting those args worked! (Though leaving the item_id commented doesn’t appear to make a difference. I read on one of the codex pages for another function that item_id is optional?).
Is it normal for there to be no CSS associated with new tabs? It doesn’t seem to even show the default CSS for an activity page? If thats not normal does that mean the templates loaded are wrong or am i missing something else?
For anyone looking to do the same as me the working code is below:
//Function for new My Favourites tab function bpmc_my_favourites_setup_nav() { global $bp; $parent_slug = 'my_favourites'; $child_slug = 'favourites_sub'; //Add nav item bp_core_new_nav_item( array( 'name' => __( 'My Favourites' ), 'slug' => $parent_slug, 'screen_function' => 'bpmc_my_favourites_screen', 'position' => 100, 'default_subnav_slug' => $child_slug ) ); } function bpmc_my_favourites_screen() { add_action( 'bp_template_content', 'bpmc_my_favourites_screen_content' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); } function bpmc_my_favourites_screen_content() { do_action( 'my_favorites' ); } add_action( 'bp_setup_nav', 'bpmc_my_favourites_setup_nav' ); function bpmc_get_favorites() { $activity_id = bp_activity_get_activity_id( array( 'user_id' => bp_loggedin_user_id(), 'component' => 'activity', 'item_id' => 0, //optional, zero is default value ) ); if ( ! $activity_id ) { return ''; } //Activity loop if ( bp_has_activities( $activity_id . '&scope=favorites&max=10' ) ) : while ( bp_activities() ) : bp_the_activity(); bp_get_template_part( 'activity/entry'); endwhile; endif; } add_action ( 'my_favorites', 'bpmc_get_favorites' ); /////////////////////////////////////////////////////////////////////////////// //Function for new My Mentions nav tab function bpmc_my_mentions_setup_nav() { global $bp; $parent_slug = 'my_mentions'; $child_slug = 'mentions_sub'; //Add nav item bp_core_new_nav_item( array( 'name' => __( 'My Mentions' ), 'slug' => $parent_slug, 'screen_function' => 'bpmc_my_mentions_screen', 'position' => 110, 'default_subnav_slug' => $child_slug ) ); } function bpmc_my_mentions_screen() { add_action( 'bp_template_content', 'bpmc_my_mentions_screen_content' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); } function bpmc_my_mentions_screen_content() { do_action( 'my_mentions' ); } add_action( 'bp_setup_nav', 'bpmc_my_mentions_setup_nav' ); function bpmc_get_mentions() { $activity_id = bp_activity_get_activity_id( array( 'user_id' => bp_loggedin_user_id(), 'component' => 'activity', 'item_id' => 0, //optional, zero is default value ) ); if ( ! $activity_id ) { return ''; } //Activity loop if ( bp_has_activities( $activity_id . '&scope=mentions&max=10' ) ) : while ( bp_activities() ) : bp_the_activity(); bp_get_template_part( 'activity/entry'); endwhile; endif; } add_action ( 'my_mentions', 'bpmc_get_mentions' );In reply to: Where are loops put?Okidoke! Yeah I’ve read that page in the codex among many others trying to work out the whole Loop thing. Better read it again! Thanks Dan!
In reply to: Where are loops put?* bp-legacy>buddypress>activity>index.php (in child theme folder)
In reply to: Calling a post authors activity streamHi @danbp,
Sorry I thought I was looking for the same thing? Wasn’t aware that I was hijacking as a result. Won’t happen again 🙂
In reply to: Where are loops put?Hi @danbp,
Thanks for reply. Yeah i know about those. I meant where would I put custom loops with my own filters etc. The wordpress codex says to put them in index.php. I assume that for Buddypress that would be:
bp-legacy>buddypress>activity>index.php
Then call it within bp-custom.php?
In reply to: Calling a post authors activity streamhaha, I’ll take your 2 days and raise you another 3!
If i get anywhere I will defo post it here. Haven’t found anything on the forums that’s helped so far (at least anything that I recognise as being a solution). I’m fairly new to php. Been through the plugin files and found a number of functions which are likely being used (not 100%), but just not able to call them to the new tab I’ve created.
Currently working through reading Henry’s links above on the WordPress Codex and will have a fiddle around.
In reply to: Calling a post authors activity streamYeah I’ve used the code below already to add the tab to the Buddybar (subnav tab in my case) in the required location. It’s the attempt to call/load the necessary page templates/functions and whatever else is required for the Activity Loop that I’m looking to do atm.
// Add a new subnav menu tab function new_subnav_tab() { global $bp; $parent_slug = 'notifications'; //Add subnav item bp_core_new_subnav_item( array( 'name' => __( 'Fave' ), 'slug' => fave, 'parent_url' => $bp->loggedin_user->domain . $parent_slug.'/', 'parent_slug' => $parent_slug, 'screen_function' => '????', 'position' => 30, ) ); } add_action( 'bp_setup_nav', 'new_subnav_tab' );In reply to: Calling a post authors activity streamFollowing this convo as I’m trying to add a customised activity stream to a new tab myself. Reading the above links by Henry atm…
In reply to: activityYou need to create a new php file called bp-custom.php . Then post the code @danbp posted above into it.
See here:
In reply to: Adding favourite posts as a tab in buddypress@chrisbenge did you find a solution to your q? I’m looking to do the same…
Hi all,
I’m still looking for the correct screen function to mimic/copy the existing favorites page and the method by which to load it. All I want to do is duplicate that page somewhere else.
The above code works to setup the new subnav tab but I can’t get any page content (ignore the link array item, that is obviously wrong).
Is the approach below the method by which to load a standard buddypress template to a subnav tab or is that just for custom screen functions? :