Target “admins” with different styles on the front end [closed]

There are a couple of ways to do this: With template overloads Overload these files: \bp-templates\bp-legacy\buddypress\members\single\profile\edit.php \bp-templates\bp-legacy\buddypress\members\single\profile\change-avatar At the top of the overload, do a current_user_can() check and then do or don’t show the rest of the template. Filter the button creation based on a current_user_can() check. See the filter in bp_get_displayed_user_nav() in ‘bp-members\bp-members-template.php’

The acction hook stop working if i move it from plugin file to theme’s functions.php file

Think about what you’ve written: The acction hook stop working if i move it from plugin file to theme’s functions.php file And: bp_includes is buddypress action and hooked on plugins_loaded The problem is that the code stops working when you move the code to functions.php, which is a theme file. The theme loads after plugins … Read more

Set maximum number of letters limit on xprofile fields [closed]

Try this code, if it will helps: function filtered_profile_data( $args ) { $data = bp_get_member_profile_data( $args ); $defaults = array( ‘field’ => false, // Field name ‘user_id’ => $user_id ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); switch($field) { case ‘Field Name’: // for specific field character limit $max_len = 10; break; … Read more

How can visitors redirect wp-admin to the homepage?

The codex entry for the admin_init hook has an example showing you how to do this. /** * Restrict access to the administration screens. * * Only administrators will be allowed to access the admin screens, * all other users will be automatically redirected to * ‘example.com/path/to/location’ instead. * * We do allow access for … Read more

How can I save a setting field with multiple checkbox options generated by a foreach loop on a custom wordpress admin page?

You can use the function xprofile_get_field_data( $field, $user_id, $multi_format) * @param mixed $field The ID of the field, or the $name of the field. * @param int $user_id The ID of the user. * @param string $multi_format How should array data be returned? ‘comma’ if you want a * comma-separated string; ‘array’ if you want … Read more