Forum Replies Created
-
In reply to: Inserting activity content via plugin
Hi again @valuser
Just read through the Pastebin text, and yeah the bookmark tool looks great. Worked perfectly! I’m still puzzled by why the activity item isn’t created when you create a post by clicking Home Place. My hunch is that
valuser_add_new_post_activity()isn’t executing due to thenewsbaby_after_insert_posthook not firing.In reply to: Link to members /members/member-nameHi @mvaneijgen
Which theme are you using? Which plugins do you have installed?
In reply to: BuddyPress and Fundraising Functionalitya) Not ‘out-of-the-box’ but through either plugins or custom code snippets then this can be done.
b) Try the BP Jobs Board. We request that you post your requirements and leave your contact details so that developers can contact you.
In reply to: Inserting activity content via pluginGoing back to this, the following hook can’t be firing.
do_action( 'newsbaby_after_insert_post', $post_id );If this fired, then the
valuser_add_new_post_activity()function would execute and that would result in an activity item being created.In reply to: Inserting activity content via pluginHowever a βnormalβ post via wp-admin came in just once onto activity.
Yeah, that’s expected because you’ve enabled site tracking.
did two new post transfers β they arrived but not in activity.
This bit isn’t expected because with my code in place, an activity entry should be created each time the
wp_insert_post()function in your plugin executes.There must be something going on elsewhere that we’re missing.
Just out of interest,
plugins_loadedseems rather early. Try changing that to wp on line 15. And I’m not sure that a negative priority is necessary? So for example, try changing line 15 to:add_action( 'wp', 'newsbaby_blog_addthis', 1 );I’m not 100% convinced that’ll solve the issue though.
In reply to: Inserting activity content via pluginRight, I’m with you.
After this line in the plugin
echo 'Shared successfully to your Home Place with tags: '.$tags;Can you add this?
do_action( 'newsbaby_after_insert_post', $post_id );Then change my code you added to functions.php to:
function valuser_add_new_post_activity( $post_id ) { $post = get_post( $post_id ); $user = get_userdata( $post->post_author ); $args = array( 'user_id' => $post->post_author, 'action' => $user->user_login . ' published ' . $post->post_title, 'component' => buddypress()->blogs->id, 'type' => 'new_blog_post', 'item_id' => get_current_blog_id(), 'secondary_item_id' => $post->ID, 'recorded_time' => bp_core_current_time(), 'hide_sitewide' => false ); bp_activity_add( $args ); } add_action( 'newsbaby_after_insert_post', 'valuser_add_new_post_activity' );That should do it π
In reply to: Inserting activity content via pluginHumm, that’s strange. Can you try posting a new post from the WP admin area so see if it works from there?
From http://pastebin.com/fMnJh5T0
Clicking on the ruby brings up http://imgur.com/jE3hUzD and clicking on “Home Place” effects the transfer and so far so good the transfer is inserted as a post in the users pblog
Can you paste the code which actually creates the post? For example, where does the following come from?
$post_id = wp_insert_post( array( 'post_author' => $user_id, 'post_title' => $post_title, 'post_content' => $apost_content, 'post_category' => $category_ids, 'tags_input' => $tags, 'post_status' => 'publish' ), $wp_error );In reply to: BuddyPress font sizes defaults too smallCan you check if the font size is larger when using the Twenty Fifteen theme? If so, then I’d advise that you contact the Avada theme author letting them know there’s an issue with the font size on that page.
In reply to: Inserting activity content via pluginTry adding this to your theme’s functions.php file:
function valuser_add_new_post_activity( $ID, $post ) { $user = get_userdata( $post->post_author ); $args = array( 'user_id' => $post->post_author, 'action' => $user->user_login . ' published ' . $post->post_title, 'component' => buddypress()->blogs->id, 'type' => 'new_blog_post', 'item_id' => get_current_blog_id(), 'secondary_item_id' => $post->ID, 'recorded_time' => bp_core_current_time(), 'hide_sitewide' => false ); bp_activity_add( $args ); } add_action( 'publish_post', 'valuser_add_new_post_activity', 10, 2 );That’s how I’d add new blog posts to the activity stream. I’ve hooked
bp_activity_add()to thepublished_postaction which will fire each time a new post is added to the database.Please note I haven’t tested.
In reply to: BuddyPress font sizes defaults too smallHi @ivalde
The font size is determined by your theme. Which theme are you using?
In reply to: Display all registered userHi @hemant-ahir
echo bp_core_get_total_member_count();This will display the total number of members for your installation. Note that this particular figure will account for all non-spam activated users even if they have done nothing on your site after activating their account.
echo bp_core_get_active_member_count();This figure is the total number of members that have performed some kind of site activity after activating their account (i.e. active users).
Hope this helps.
In reply to: Users login via front endHi @dallass
Take a look at the Theme My Login plugin. That helps you do all of that.
In reply to: Inserting activity content via pluginWhat are you hooking your
bp_activity_add()function to?Also it’s weird that the inserted post has a guid ending in /post-name, which is a different format to the rest of your posts. The guid is something you shouldn’t really need to override, it’s best to let WP handle it.
In reply to: please review my new website onlijn.comVery cool theme! I like the colour scheme you’ve used along with the flat design. Navigating around using my laptop, everything seems to work fine. My only criticism is when I use my tablet (Google Nexus 7) to view at portrait orientation, the 3-column layout seems a little squished. Aside from that minor issue, all looks good
I’m not sure your code will work. For example, on a very quick first look, I can see you’ve done
current_user_can('administrator'). I’m assuming you’re trying to check if the current user is an admin? If so, then this won’t work. Thecurrent_user_can()function takes a capability, not a role. So if you want to check if the current user is an admin, you should do something like thiscurrent_user_can( 'manage_options' )Ref: https://codex.wordpress.org/Function_Reference/current_user_can
In reply to: avatar does not showCan you try activating the Twenty Fifteen theme to see if them problem still happens?
Hi @screampuff
You could try the following function which will stop unwanted users from viewing the page directly if they tried typing the URL:
function my_hide_achievements_page() { $role = xprofile_get_field_data( 'Membership' ); if ( ( $role != 'Administrator' ) || ( bp_current_user_id() == bp_displayed_user_id() ) ) return; // I guess we should 404 this page because this member isn't an admin or the displayed member. $wp_query->set_404(); status_header( 404 ); nocache_headers(); } add_action( 'init', 'my_hide_achievements_page' );In reply to: avatar does not showHi @alocin82
Which theme are you using?
Hi @rudik123
Just to make you aware, BuddyPress developers add new features to BP core only if that particular feature will benefit the entire community. So even if you offer $1,000s, the feature request may get rejected. That doesn’t mean to say the door is closed and that’s where plugins come in. Many people choose to hire a developer to create some functionality they need ‘as a plugin’.
There’s an Ideas forum already available which lets you submit ideas for plugins etc. You could potentially find some like-minded users on there, group together to contact a developer, and request something be built:
Useful links:
In reply to: Inserting activity content via pluginHaving re-looked over your code for
bp_activity_add()above, try setting the activitytypetonew_blog_postFor example:
$activity_id = bp_activity_add( array( 'action' => 'A link from NewsSite', // The activity action - e.g. "Jon Doe posted an update" 'content' => $post_content, // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!" 'component' => false, // The name/ID of the component e.g. groups, profile, mycomponent 'type' => new_blog_post, // The activity type e.g. activity_update, profile_updated 'primary_link' => 'false', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink) 'user_id' => bp_loggedin_user_id(), // Optional: The user to record the activity for, can be false if this activity is not for a user. 'item_id' => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id 'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id 'recorded_time' => bp_core_current_time(), // The GMT time that this activity was recorded 'hide_sitewide' => false, // Should this be hidden on the sitewide activity stream? 'is_spam' => false // Is this activity item to be marked as spam? ), );In reply to: Private Messaging ‘Page Not Found’ issueThanks for the update @kateleedotinfo.
Hiding tabs via CSS isn’t the best way to do it as I’m sure you’ll know. If you find a better solution then let us know π
In reply to: Where to add a code for forumHi @lovecoinz
Try asking over at bbPress as the solution you need is more related to that plugin rather than BuddyPress.
In reply to: Login page for usersHi @fanmusic
Check out Theme My Login. That’s one of the easiest and most secure ways to do it.
In reply to: Inserting activity content via pluginAny chance you can post all of your code? Perhaps in Pastebin? The code you’ve provided here looks sound so there must be something else at fault
In reply to: How To bp_set_member_type?Hi guys
My snippet shows you how to set a default type as you asked for this in the second half of your question. It won’t be useful if you want to set a member type from the admin area. That’ll need a different solution.
Hope this helps.