Forum Replies Created
-
Thanks for the quick answer much appreciated! Looks good will try it out. My site will still be visible to the world.. just people outside blocked countries not allowed to sign up? ๐
Sorted using the code from :https://buddypress.org/support/topic/private-message-friends-only/
One question will the messages still be stored in the database even if the message isnt sent? I dont want these spammers filling up my database with junk..
๐
Does anyone know how to set the <title> tags set in the header of a activity to be the first 50 or so character take from the activity? As This will at least give some clues on the search results page what the page might be about?
Anyone got any ideas for this as in search engine none of my buddypress posts rank whilst bbpress posts do because of use of title…
function rm_comment_nofollow($txt) { $user_id = bp_get_activity_comment_user_id($comment_ID) ; $user_meta=get_userdata($user_id); $user_roles=$user_meta->roles; $allowed_roles = array('editor', 'administrator'); if( array_intersect($allowed_roles, $user_roles ) ) { $txt=str_replace(' rel="nofollow"','',$txt); } return $txt; }
For example using along side other function code found above that I am currently using works but only if admin/editor posts on an admin editor activity comment ๐ :/ ๐ฎ
If user makes a comment on an admins comments then it appears without nofollow which I want but when comment made on activity comment from non admin comment link appears with a nofollow which im guessing because getting to the role in the if statement from the activity id rather than the comment id? How can I fix this to work for both main activity updates and comments?
Also the way im doing it probably isnt very fast because buddypress is adding the nofollow and then all im doing is search and removing the nofollow every single time :/
Okay I have managed to get it to work for new activity posts however when admin makes comment with link it appears nofollow? How can I make this code work for activity comments replies too? thank you!
โ
function rm_nofollow($txt) { $user_id = bp_get_activity_user_id( $activity_id ) ; $user_meta=get_userdata($user_id); $user_roles=$user_meta->roles; $allowed_roles = array('editor', 'administrator'); if( array_intersect($allowed_roles, $user_roles ) ) { $txt=str_replace(' rel="nofollow"','',$txt); } return $txt; } add_filter('bp_get_activity_content','rm_nofollow',20); add_filter('bp_get_activity_content_body','rm_nofollow',20); add_filter('bp_get_activity_parent_content','rm_nofollow',20); add_filter('bp_get_activity_latest_update','rm_nofollow',20); add_filter('bp_get_activity_latest_update_excerpt','rm_nofollow',20); add_filter('bp_get_activity_feed_item_description','rm_nofollow',20); add_filter('bp_get_activity_feed_item_description','rm_nofollow',20);
is there a way I can edit/overwrite “bp_activity_make_nofollow_filter_callback” and change the rel=”nofollow” text replace to replace with blank?
I know what your saying but I like having full editorial control of my site and don’t want links posted by admins(me) being nofollowed if they are directed to sites that I own. Also if an accredited user who posts useful content posts a good link surely that link should be rewarded?
๐
Tried just about every combination I can think of and still cannot seem to get rel”nofollow” removed let alone get it to just be removed for admin/editor roles ๐
@dcavins thank you for your reply I really do appreciate you taking time to help me!
โ
For me this doesn’t seem to be working when I create an update with an urladd_action( 'bp_loaded', function() { remove_filter( 'bp_get_activity_content', 'bp_activity_make_nofollow_filter' ); remove_filter( 'bp_get_activity_content_body', 'bp_activity_make_nofollow_filter' ); remove_filter( 'bp_get_activity_parent_content', 'bp_activity_make_nofollow_filter' ); remove_filter( 'bp_get_activity_latest_update', 'bp_activity_make_nofollow_filter' ); remove_filter( 'bp_get_activity_latest_update_excerpt', 'bp_activity_make_nofollow_filter' ); remove_filter( 'bp_get_activity_feed_item_description', 'bp_activity_make_nofollow_filter' ); } );
โ
โ
I have now tried just adding
remove_filter( ‘bp_activity_post_update’, ‘bp_activity_make_nofollow_filter’ );
but that didnt work ๐
Or if not how can I just turn off the rel nofollow for all users then?
Posted on Bbpress forums and looks as though the solution provided their for getting rid of nofollow seem to get ignored when buddypress activated see link to forum thread
Iv been searching around everywhere and cannot seem to find any solution for this? ๐
Looks like this is something to do with itwp_rel_nofollow_callback() – Callback to add rel=nofollow string to HTML A element.
Thank you!!! have a great day!
Wait it seems this was caused by me not setting friend connections and private message in buddypress settings..
@fakrulislam thank you!! Coincidentally I was having trouble with this with twentysixteen and just creating a stylesheet in buddypress/css and now the cover image appears thanks to that code! YAY!!!!!!!!!!!!!!!!!!!!!!!
Okay I managed to create a add friend button using some code found on this website.. but im still a little stuck on creating a send private message button? any help would be great! thank you!
at the moment I am using
<?php if ( bp_has_message_threads() ) : ?> <div class="pagination-count"> <?php bp_messages_pagination_count() ?> </div> <div class="pagination-links"> <?php bp_messages_pagination() ?> </div> <ul id="message-threads"> <?php while ( bp_message_threads() ) : bp_message_thread(); ?> <li> <!-- Example template tags you can use --> <?php bp_message_thread_avatar() ?> <?php bp_message_thread_from() ?> <?php bp_message_thread_last_post_date() ?> <a href="<?php bp_message_thread_view_link() ?>"><?php bp_message_thread_subject() ?></a> <?php bp_message_thread_excerpt() ?> <a href="<?php bp_message_thread_delete_link() ?>"><i class="fa fa-times" aria-hidden="true"></i></a> </li> <?php endwhile; ?> </ul> <?php else: ?> <div id="message" class="info"> <p>There are no messages to display.</p> </div> <?php endif;?>
the standard loop for messages however the delete message link doesn’t work it just sends me to a 404 page. Also is there a way to make it ajaxsy and make it delete the message straight away??
great thank you! ๐
although im struggling with the friend request count as it seems to just ignore the if statement
user_login . ‘/friends/requests/’; ?>”><i class=”fa fa-users” aria-hidden=”true”></i>
` <?php
$friend_requests_count = bp_friend_total_requests_count( bp_loggedin_user_id() );
if ( $friend_requests_count < 0 ) {
echo ‘<div class=”site-header-user-friend-requests-bubble”>’; echo $friend_requests_count; echo ‘</div>’;
} else {
echo ‘<div class=”display-none”></div>’;}
?>`
Or if there is no function for group count a inbox count and a link to inbox would also be super handy! thank you so much in advance:)
Great thank you! ๐
Okay I now have this above my my buddypress div in the activity.php
<div class="activity-sidebar-left"> <div id="item-header" role="complementary"> <?php add_filter('bp_displayed_user_id','bp_displayed_outside_bp'); function bp_displayed_outside_bp($id){ return ($id==0) ? get_current_user_id() : $id; } $cover_image_url = bp_attachments_get_attachment( 'url', array( 'item_id' => bp_displayed_user_id() ) ); if ( bp_displayed_user_use_cover_image_header() ) : bp_get_template_part( 'members/single/cover-image-header' ); else : bp_get_template_part( 'members/single/member-header' ); endif; ?> </div><!-- #item-header --> </div>
but for some reason the cover image will not show up but the username and that does? anyhelp guys would be super! thank you.
I have also tried this placing this code in my div in activity.php
<div id="item-header" role="complementary"> <?php /** * If the cover image feature is enabled, use a specific header */ if ( bp_displayed_user_use_cover_image_header() ) : bp_get_template_part( 'members/single/cover-image-header' ); else : bp_get_template_part( 'members/single/member-header' ); endif; ?> </div><!-- #item-header -->
but it not grabbing any data and just shows
@ Public Message Not recently active
with no reference to my user and no cover image.
if I copy this code into my side bar div
<?php /** * Fires before the display of member home content. * * @since 1.2.0 */ do_action( 'bp_before_member_home_content' ); ?> <div id="item-header" role="complementary"> <?php /** * If the cover image feature is enabled, use a specific header */ if ( bp_displayed_user_use_cover_image_header() ) : bp_get_template_part( 'members/single/cover-image-header' ); else : bp_get_template_part( 'members/single/member-header' ); endif; ?> </div>
it tries to display links and cover images but doesn’t actually pull anything to display