Forum Replies Created
-
In reply to: @mentions interface doesn’t work
Unless you’ve created bp-custom.php yourself, you won’t have one.
If you can verify that you’re using Twenty Fifteen, no plugins activated, and have made no custom code changes, then please feel free to open a ticket on Trac. Please provide the developers with as much info as you can (see here) and describe the problem you’re seeing in as much detail as you can. Also, feel free to reference this thread.
In reply to: @mentions interface doesn’t workDo you have a bp-custom.php file? Can you make sure to remove any custom code you have in that file if you have created it?
In reply to: Avatar upload on sign up, s2members@ouegy you wrote the function, so the credit is all yours! 🙂
In reply to: Buddypress = website dowmThe error log seems to indicate the problem is coming from the theme
x. For example:wp-content/themes/x/framework/functions/global/plugins/buddypress.php on line 478
Can you try reverting to the Twenty Fifteen theme to see if the issue is resolved?
In reply to: Avatar upload on sign up, s2membersAlso, if you wanted to condense your function into less statements, you could use the
set_role()method instead ofremove_role()andadd_role(). See hereIn reply to: Avatar upload on sign up, s2membersI’m not using s2member so can’t test your function. However, I think you’re almost on the right track. One thing I noticed was your use of
$user->ID. I don’t see where you’re getting the$userobject from? You might need to useget_current_user_id()instead. Try:<?php add_action( 'xprofile_avatar_uploaded', 'update_membership_level' ); function update_membership_level() { $u = new WP_User( get_current_user_id() ); // Remove role $u->remove_role( 's2member_level1' ); // Add role $u->add_role( 's2member_level2' ); } ?>In reply to: @mentions interface doesn’t workTry deactivating all plugins to see if the problem resolves itself. Perhaps deactivate them one-by-one, checking each time. The idea is to find out what piece of code has introduced the problem.
In reply to: Avatar upload on sign up, s2members…is there some sort of event hook that could fire on this to change the user’s role eg. make them a full member (level_2)
Yes. That’d be
xprofile_avatar_uploaded. It fires immediately after the new avatar is processed.In reply to: @mentions interface doesn’t workWhich plugins do you have installed?
In reply to: @mentions interface doesn’t workHi @chcsuter
Do @-mentions work with the Twenty Fifteen theme activated?
In reply to: Buddypress = website dowmHi @casesolver
Provider says it is because it’s in remote
Can you ask them to clarify what they mean by this?
In reply to: Avatar upload on sign up, s2membersThere’s a lot more to uploading an avatar than just saving the meta. Check out
xprofile_screen_change_avatar()to see how BuddyPress handles the process.Along with saving meta info, you’ll need to handle the actual file and save it to your file system (just as BuddyPress does). Then there’s cropping to think about too.
Hope this info helps.
In reply to: Avatar upload on sign up, s2membersHi @ouegy
How are you saving the actual file to your file system?
In reply to: Create custom register.php pageHi @mvaneijgen
Take a look at the BuddyPress Template Hierarchy article. It explains how BuddyPress will look for specific template files inside your theme if you’ve created them. These then override the default.
In reply to: Pre loading membersThe wp_users table description can be found here:
https://codex.wordpress.org/Database_Description
And here’s the BuddyPress database diagram:
Hope that helps you.
In reply to: [Resolved] Friendship request not workingTry using the Twenty Fifteen theme and then deactivating all plugins one-by-one. The idea is to find out which piece of code is introducing the problem.
In reply to: avatar does not showOK, now with Twenty Fifteen activated, try deactivating all plugins you have installed and remove any custom code you may have in your bp-custom.php file (if you have one).
In reply to: Pre loading membersHi @alexbotkin
I’m not aware of an Excel importer. Perhaps try searching the WordPress Plugin Directory for one.
In reply to: Add custom xprofile linksRight. In that case, you can just modify the output of your
forloop. For example:for ( $i = 0; $i < $sportsSize; $i++) { // For this particular $i, get the URL here and store it in a $url variable. You may need to query the db again? i.e. where will you get the URL from, or where are you storing it? $femaleSport = $wpdb->get_var( "SELECT COUNT(user_id) FROM ar_bp_xprofile_data WHERE value = 'female' AND user_id IN (SELECT user_id FROM ar_bp_xprofile_data WHERE value = '" . $sports[$i] . "')" ); if ($femaleSport != 0) { // Update the output of the loop to include hyperlink markup. echo '<p><a href="' . $url . '">' . $sports[$i] . ' (' . $femaleSport . ')</a></p>'; $femaleCounter++; } }In reply to: How To bp_set_member_type?If you look at my snippet here, you will see that I’ve hooked the
my_set_default_member_type()function tobp_core_signup_user. Now,bp_core_signup_userfires each time a new user registers on your website. This means thatbp_set_member_type( $user_id, 'student' )executes each time a new user registers on your site.Then if you look here, you’ll see I’ve hooked my
youmin_set_role()function to thebp_set_member_typehook (note that thebp_set_member_typehook and thebp_set_member_type()function are different things). This means that when thebp_set_member_typehook fires, the code insideyoumin_set_role()will execute.So as you can see, you have to use both snippets together, exactly as I’ve written them, in order for things to work.
In reply to: How to assign a WP user role based on a registrationHi @youmin
My post was this:
Just to point out, you can’t use or in PHP. Instead you should use a double pipe like this ||.
This is wrong! You can in fact use the
oroperator in PHP, it just takes a lower precedence than||.Hence why I deleted my post.
Hope that clears things up.
In reply to: How To bp_set_member_type?Hi @youmin
If you don’t already have your roles set-up then this is how you’d add them:
add_role( 'student', __( 'Student' ), array( 'read' => true, // true allows this capability 'edit_posts' => true, 'delete_posts' => false, // Use false to explicitly deny ) );The 3rd parameter is where you’d put your capabilities. In my example above, I’ve created a ‘student’ role which can read and edit posts but can’t delete posts. Feel free to amend these capabilities.
Ref: https://codex.wordpress.org/Function_Reference/add_role
Then to pick up on Boone’s suggestion in the Trac ticket, you could do this:
function youmin_set_role( $user_id, $member_type, $append ) { $userdata = array( 'ID' => $user_id, 'role' => $member_type ); wp_update_user( $userdata ); } add_action( 'bp_set_member_type', 'youmin_set_role', 10, 3 );When you use the
bp_set_member_type()function like I have done here, this code will assign a role to the user who is signing up. The role that is assigned will be the type you use inbp_set_member_type().Hope this helps you.
In reply to: Add custom xprofile linksHi @barodscheff
Can you clarify exactly what you’d like to link and where you’d like to link to?
You’ll need to switch to the default theme (let’s say Twenty Fifteen) to see if that works. Also, deactivate your plugins one by one. The idea is to isolate the issue (work out which plugin is introducing the problem)
Which theme and plugins are you using?