Forum Replies Created
-
I could maybe help out! I estimate that it would cost ~$100-200. I specialize in WordPress plugin extensions, you can check my website out at http://coffeywebdev.com!
I’ve been pretty busy lately, but I found a potential solution on these forums:
I’d be happy to help you make these adjustments, you can direct message me about cost/timeline/etc.
In members-loop.php use this
<?php if ( bp_has_members(bp_ajax_querystring( ‘members’).’&type=alphabetical’) ) : ?>
source: https://buddypress.org/support/topic/show-all-members-in-buddypress-directory/
Buddypress does not support this functionality out of the box, but with a little PHP knowledge one could make these adjustments to your buddypress site.
Be sure when making customizations that you don’t overwrite the plug-in! You can include BuddyPress/bbPress template files in your theme and modify them to do whatever you want. The possibilities are endless!
Check out the BuddyPress documentation for more info on extending BuddyPress for custom features.
This may be worth looking into? I’ve used it before, Gravity Forms is a great plugin with a lot of excellent add-ons.
addon for plugin:
You could hook into the
bp_activity_add
action like this:function bp_plugin_hook_activity_add( $activity ) { // insert code to be executed when activity is created // read the link below for more code examples } add_action( 'bp_activity_add', 'bp_plugin_hook_activity_add', 10, 1 );
You can access the activity variables like this:
$activity[‘type’] or $activity[‘content’]
you should be able to use any of the keys below:
id
action
content
component
type
primary_link
user_id
item_id
secondary_item_id
recorded_time
hide_sitewide
is_spamFor more reading check out this link:
You could try using the WordPress API, there is a function called
login_redirect()
/** * Redirect user after successful login. * * @param string $redirect_to URL to redirect to. * @param string $request URL the user is coming from. * @param object $user Logged user's data. * @return string */ function my_login_redirect( $redirect_to, $request, $user ) { //is there a user to check? if ( isset( $user->roles ) && is_array( $user->roles ) ) { //check for admins if ( in_array( 'administrator', $user->roles ) ) { // redirect them to the default place return $redirect_to; } else { return home_url(); } } else { return $redirect_to; } } add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );
You need to add something like the code above your child theme functions.php file, or you can create a plugin and add this code to it.
https://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect
look for a ‘premium content’ plugin that can lock down pages based on user role, or user ID..
there are probably several plugins that can do this for you, I’ll link one or two…
User Access Manager seems to be your best bet, it seems a little better than restrict content. Both are still active and have recent updates.
https://wordpress.org/plugins/user-access-manager/
https://wordpress.org/plugins/restrict-content/If you are looking for more features than simple page locking:
https://wordpress.org/plugins/s2member/There are other plugins available that do this as well, I just listed a few free solutions.
I hope that helps you!
Anthony Coffey
did you set the $blog_id variable? You must pass a number like this:
define ( 'BP_ROOT_BLOG', 3 );
Note: In WordPress 3.1, your $blog_id can be found by navigating to the “Network Admin > Sites” page and hovering over the blog in question. You should see a link that resembles this:
In the WordPress dashboard, find under “Users” a link titled, “Profile Fields” (Users>Profile Fields)
Here you can add profile fields to the signup process, if you don’t want to add the fields to signup you need to add a new field group.
The field group ‘Base’ is added to signup process
I hope that helps
or simply the ‘user_register’ action hook should work? let me know if that works for you
I think ‘bp_init’ is the wrong hook.. Try using ‘bp_core_signup_user’
function save_wc_address() { if ( wp_verify_nonce( $_POST['bp_settings_general'] ) ){ $user_id = sanitize_text_field( $_POST['user_id'] ); //sanitize input data $billing_phone = sanitize_text_field( $_POST['billing_phone'] ); //update user meta update_user_meta( $user_id, 'billing_phone', $billing_phone); } } add_action( 'bp_core_signup_user', 'save_wc_address');
The plugin ‘buddypress-media’ is causing an error by using a function that no longer exists, ‘bp_register_group_extension’.
Try updating RT Media(BuddyPress Media) and see if that fixes your problem.
To restore your site you can update the plugin using FTP, or rename the folder to restore your site and get rid of that error.
also ‘bp_signup_validate’
function bp_password_beefing() { global $bp; if ( !empty( $_POST['signup_password'] ) ) if ( strlen( $_POST['signup_password'] ) < 6 ) $bp->signup->errors['signup_password'] = __( 'Your password needs to be at least 6 characters', 'buddypress' ); } add_action( 'bp_signup_validate', 'bp_password_beefing');
Parse error: syntax error, unexpected '.' in themes/icynets-simplic/inc/customizer.php on line 437
That’s saying there is a period or ‘dot’ where there shouldn’t be.
Renaming the theme would at least make the site recovered(force deactivation of theme), then you could access the WordPress dashboard again if you don’t have FTP
Then you could use the WordPress editor to make the edit you need possibly.
I hope that helps, I’m kind of new to the forums coming from the support side
you need FTP access to edit the file after diagnosing the error, and then it will be okay.
Check the error log, and then edit the suspected file using the FTP editor of your choice to fix the bug.
OR
you can rename the plugin customizer PHP? if that’s a plugin, just rename the folder in wp-content/plugins and maybe it won’t include your broken code.
In the WordPress dashboard, find under the Users menu a link titled, “Profile Fields”(Users>Profile Fields)
Once you click on this link, then you can add new fields to the profile by clicking the Add New Field button.
When you’ve added a field to the Base(Primary) field group, then it will appear on your registration pages and user profiles.
Copy the buddypress theme into your WordPress child theme, and then you can modify the register template if needed.
copy the buddypress theme into your child theme by pasting this path into your child theme folder
/wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypresspath of file for registration fields is this:
/wp-content/themes/child-theme/buddypress/members/register.phpThen, add First and Last name fields under User>Profile Links in the WordPress Dashboard.
Currently there is a ‘Name’ field that is required, you can edit it to read ‘First Name’ then add another ‘Last Name’ field..
Then you need to process the data before it saves into the database, I’m kind of at a loss here… I would need more time to brainstorm on it but I did find this hook ‘bp_core_signup_user’
I believe this is the hook you are looking for:
// define the bp_core_signup_user callback function action_bp_core_signup_user( $array, $int, $int ) { // make action magic happen here... }; // add the action add_action( 'bp_core_signup_user', 'action_bp_core_signup_user', 10, 3 );
I’m working on a solution for you now, will respond again soon.
I use the “$comment = get_comment( $comment_id )” only to get the info I need about the comment..
For example, in my activity stream I need to know what the comment said, who said it, and what post did they comment on… So, I use the get_comment() function to store all of my comment data so that I can use it in the activity stream.
What exactly do you want the activity to say? I’m pretty sure I can help!
Take a look at this code, I think it may be helpful for you…
I created a function vp_add_group_activity_comments() that hooks to the ‘post_comment’ action, so when a user posts a comment an activity stream item is created and added to their group’s feed.. (on my site users can only be in one group at a time)
It’s all about what you set for the $args array….
function vp_add_group_activity_comments($comment_id){ $comment = get_comment( $comment_id ); GLOBAL $wpdb; $user_id = get_current_user_id(); $user_info = get_userdata( $user_id ); $current_user_group_id = $wpdb->get_var("SELECT group_id FROM ".$wpdb->prefix."bp_groups_members WHERE user_id = '".(int)$user_id."'"); $comment_action = "<a href='".site_url()."/members/".$user_info->user_login."'>".$user_info->first_name." ".$user_info->last_name."</a> posted a comment on <a href='".get_permalink($comment->comment_post_ID )."'>".get_the_title($comment->comment_post_ID)."</a>"; // arguments to pass to the bp_activity_add() function $args = array( 'action' => $comment_action, // The activity action - e.g. "Jon Doe posted an update" 'content' => $comment->comment_content, // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!" 'component' => 'groups', // The name/ID of the component e.g. groups, profile, mycomponent 'type' => 'activity_update', // The activity type e.g. activity_update, profile_updated 'primary_link' => get_permalink($comment->comment_post_ID ), // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink) 'user_id' => $user_id, // Optional: The user to record the activity for, can be false if this activity is not for a user. 'item_id' => $current_user_group_id, // Optional: The ID of the specific item being recorded, e.g. a blog_id 'secondary_item_id' => $comment->comment_ID, // 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' => 0, // Should this be hidden on the sitewide activity stream? 'is_spam' => 0, // Is this activity item to be marked as spam? ); $add_activity = bp_activity_add($args); // Update the group's last activity groups_update_last_activity( $current_user_group_id ); return true; } add_action('comment_post', 'vp_add_group_activity_comments' );
Take a look at the code below to see how I use the post_comment action to hook my function vp_add_group_activity_comments(), which creates an activity stream item when a user posts a comment and adds it to their group’s activity stream… This is just what we are doing for our site, but if you look at the code you should be able to figure out how to do it for your site….
function vp_add_group_activity_comments($comment_id){ $comment = get_comment( $comment_id ); GLOBAL $wpdb; $user_id = get_current_user_id(); $user_info = get_userdata( $user_id ); $current_user_group_id = $wpdb->get_var("SELECT group_id FROM ".$wpdb->prefix."bp_groups_members WHERE user_id = '".(int)$user_id."'"); $comment_action = "<a href='".site_url()."/members/".$user_info->user_login."'>".$user_info->first_name." ".$user_info->last_name."</a> posted a comment on <a href='".get_permalink($comment->comment_post_ID )."'>".get_the_title($comment->comment_post_ID)."</a>"; // arguments to pass to the bp_activity_add() function $args = array( 'action' => $comment_action, // The activity action - e.g. "Jon Doe posted an update" 'content' => $comment->comment_content, // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!" 'component' => 'groups', // The name/ID of the component e.g. groups, profile, mycomponent 'type' => 'activity_update', // The activity type e.g. activity_update, profile_updated 'primary_link' => get_permalink($comment->comment_post_ID ), // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink) 'user_id' => $user_id, // Optional: The user to record the activity for, can be false if this activity is not for a user. 'item_id' => $current_user_group_id, // Optional: The ID of the specific item being recorded, e.g. a blog_id 'secondary_item_id' => $comment->comment_ID, // 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' => 0, // Should this be hidden on the sitewide activity stream? 'is_spam' => 0, // Is this activity item to be marked as spam? ); $add_activity = bp_activity_add($args); // Update the group's last activity groups_update_last_activity( $current_user_group_id ); return true; } add_action('comment_post', 'vp_add_group_activity_comments' );
@shanebp, I am unable to get comments to show up in my activity feed.. I even set up a staging environment, running only Buddypress with 2015 theme…. Still no comments! 🙁
Creating a post adds a row to the activity table, but commenting on that post doesn’t do anything.. Any thoughts??
I have made sure that I have buddypress properly configured to track post comments, but it isn’t working on my live site, or the staging environment that is running default wordpress theme and only one plugin, Buddypress..
Your help is much appreciated
I would love to!
But my solution is basically an s2 membership hack.. so it doesn’t really apply to buddypress..
I just hacked up my members loop, and stuck some s2 membership code in there.
I have decided that due to the nature of S2 Membership’s logic, this would be far too difficult to do than it is worth.. I found a work around…
ISSUE RESOLVED
because I’d like to split them up with a header for each section..
i.e.
<h2>Affiliate Members</h2>, then the loop
<h2>Professional Members</h2>, then the loop