Shamim Hasan
Forum Replies Created
-
AuthorPosts
-
Shamim HasanKeymaster
It require many code change.
If you need this feature badly you can contact through https://www.shamimsplugins.com/hire/Shamim HasanKeymasterSee your role name
'Viitasaari
started with'
. Remove that'
from role name. Then try.Let me know.
Shamim HasanKeymasterThere are add more buttons for Admins and Groups in Front End PM PRO > Settings > Recipient. Does those work?
Are you having any js error in role to role block setting page? Please see browser console and let me know.Shamim HasanKeymasterShamim HasanKeymasterUnchecked Front End PM PRO > Settings > Recipient > Can users send message to admin.
Yours can still send message using https://www.shamimsplugins.com/docs/front-end-pm/shortcode/fep_shortcode_new_message_form/September 5, 2018 at 11:07 pm in reply to: How to see old announcements after the role change #17272Shamim HasanKeymasterUse this code
add_action( 'add_user_role', 'fep_cus_update_ann_when_role_change', 10, 2 ); add_action( 'set_user_role', 'fep_cus_update_ann_when_role_change', 10, 2 ); function fep_cus_update_ann_when_role_change( $user_id, $role ) { global $wpdb; if ( ! defined( 'FEP_PARTICIPANT_TABLE' ) ) { return false; } $mgs_ids = $wpdb->get_col( $wpdb->prepare( "SELECT fep_message_id FROM $wpdb->fep_messagemeta where meta_key = %s AND meta_value = %s", '_fep_participant_roles', $role ) ); if ( $mgs_ids ) { $query = 'INSERT INTO ' . FEP_PARTICIPANT_TABLE . ' (mgs_id, mgs_participant) VALUES '; foreach ( $mgs_ids as $mgs_id ) { $values[] = $mgs_id; $values[] = $user_id; $place_holders[] = '(%d, %d)'; } $query .= implode( ', ', $place_holders ); $wpdb->query( $wpdb->prepare( $query, $values ) ); delete_user_meta( $user_id, '_fep_user_announcement_count' ); } }
September 5, 2018 at 10:26 pm in reply to: Group Visibility (Role Restriction) In personal settings #17270Shamim HasanKeymasterAdd following code in your theme’s (child theme’s if any) functions.php
add_filter( 'fep_get_option', function( $value, $option, $default, $is_default ) { if ( 'gm_groups' !== $option ) { return $value; } if ( is_admin() && 'users' !== @get_current_screen()->parent_base ) { return $value; } if ( ! is_admin() && 'settings' !== @$_GET['fepaction'] ) { return $value; } // Change this with which role you want to give access to all groups $allowed_roles = array( 'editor', 'administrator' ); if ( array_intersect( $allowed_roles, wp_get_current_user()->roles ) ) { return $value; } // Change this with your desire groups slug $groups = array( 'test1', 'test2' ); foreach ( $groups as $group ) { unset( $value[ $group ] ); } return $value; }, 10, 4 );
Change roles and groups as required
September 5, 2018 at 8:45 pm in reply to: Group Visibility (Role Restriction) In personal settings #17254Shamim HasanKeymasterSo you want to restrict those groups so that only editor and administrator can see those group in user settings page, other users cannot see those groups in settings page (in front-end), right?
Shamim HasanKeymasterFrom version 10.1.1 this works your way. Users can get only messages which is sent when they are in that group.
Shamim HasanKeymasterFrom version 10.1.1 both group message and announcement work this way. Users can access group messages/ announcements only which is sent when they are in that role/group.
I have tested above code again and find working.
I have created an announcement to test role RA. Then i have checked if user UA (which user role is not RA) have got that announcement. find that user UA have no access to that announcement. Now i changed that user role to RA and now that user have access to that announcement.Please check and let me know.
Shamim HasanKeymasterAdd following code in your theme’s (child theme’s if any) functions.php
add_action( 'set_user_role', function( $user_id, $role, $old_roles ) { global $wpdb; if ( ! defined( 'FEP_PARTICIPANT_TABLE' ) ) { return false; } $mgs_ids = $wpdb->get_col( $wpdb->prepare( "SELECT fep_message_id FROM $wpdb->fep_messagemeta where meta_key = %s AND meta_value = %s", '_fep_participant_roles', $role ) ); if ( $mgs_ids ) { $query = 'INSERT INTO ' . FEP_PARTICIPANT_TABLE . ' (mgs_id, mgs_participant) VALUES '; foreach ( $mgs_ids as $mgs_id ) { $values[] = $mgs_id; $values[] = $user_id; $place_holders[] = '(%d, %d)'; } $query .= implode( ', ', $place_holders ); $wpdb->query( $wpdb->prepare( $query, $values ) ); delete_user_meta( $user_id, '_fep_user_announcement_count' ); } }, 10, 3 );
Shamim HasanKeymasterNext version i will enable this by default.
Shamim HasanKeymasterMay be next week.
Shamim HasanKeymasterThank you.
“Display name publicly as” is the name which is made to show publicly.
First Name and Last Name is saved in meta and is not searchable by default.
When you search a user it searches by id, Username, Nickname, Email, Website url. So when you do not found any user please check if you are searching by any of these.Shamim HasanKeymasterThank you.
I really appreciate. -
AuthorPosts