Home › Forums › Front End PM PRO › Extra mail variable request.
- This topic has 12 replies, 2 voices, and was last updated 6 years ago by Andrew Perryman.
-
AuthorPosts
-
December 21, 2018 at 2:20 pm #19983Andrew PerrymanParticipant
Shamim,
The message system is now becoming popular between the staff and members.However as we have quite a number of groups set up it has become evident that a number of people are in the same groups and this has led to some confusion a regards replies because their is similar subjects but no way to difinatly distinguish which mail belongs to what group.
Hence this has led to quite a few mails being replied to by the members unfortunately replying to the wrong message if they are part of three or more groups.
i.e. Art, Gardening, bureau, volunteers etc.
so is it possible to add another variable that I can use to at to the message subject to identify the group the message belongs to?
As there is only one mail message template used for all new and reply messages, could the best variable capability be the name of the group in variable format i.e. {{Art}} or {{Gardening}} etc so these could be used to pre load the template mail subject so the user / member can instantly recognise what group the mail belongs to and thus not become confused and reply appropriately to the correct group mail.
I have had a lot of accidental cross mail group talk by members where they have misunderstood and replied with a message to the wrong group.
you can understand that some message content has been sent that is not meant for other members in other mail groups to digest and has caused a social stir and a few complaints.
Look forward to your thoughts and questions as regards the request for an extra variable to help clarify different group messages in your next version update..
Andrew
December 21, 2018 at 7:11 pm #19988Shamim HasanKeymasterYou can add your own tag if you want. Please see https://www.shamimsplugins.com/docs/front-end-pm-pro/customization-front-end-pm-pro/add-own-email-tag/
December 22, 2018 at 10:22 pm #20010Andrew PerrymanParticipantHi Shamim,
I think what I really need is a way to allow a variable (or Tag) to be called {{Group}} and place it in the message or subject in the template so that it translates to the group name that was chosen by the user when a new message is initiated. i.e. the {{Group}} variable would translate to “Art” if the user checks the group created and called “Art” to send a message to.
Please excuse if the custom tag can do this but I would need to know how or where the system or what the variable is called that parses the group name on the send to list for groups.
This would then be carried across and set within the {{Group}} variable for that message.
Do you understand what I am asking for ?
Andrew
December 22, 2018 at 10:59 pm #20013Andrew PerrymanParticipantPS..
Shamim,
I have just started reading through your code but it is wood for trees sometimes but is the variable I am after called – “$message_id” – does this represent the mail group name?
e.g.
So would this work…
add_filter( 'fep_eb_email_legends', function( $legends, $post, $user_email ){
$legends['group'] = array(
'description' => __('Mail group name', 'front-end-pm'),
'where' => array( 'newmessage', 'reply' ), //where this tag will be used
'replace_with' => '$message_id'
);
return $legends;
}, 10, 3);
Or have I got this totally wrong and it is called something else?
Andrew
December 23, 2018 at 12:01 am #20016Andrew PerrymanParticipantPPS..
Plus this will need extra code wrapped around it to identify and to only set the tag if a group is chosen..
Andrew
December 23, 2018 at 12:47 am #20019Andrew PerrymanParticipantPPPS..
Shamim,
I am shooting in the dark here, what variable should it be to set the current group the message is being sent to?
For example..
‘replace_with’ => [ $group ][‘name’]
Andrew
December 23, 2018 at 3:12 am #20022Shamim HasanKeymasteradd following code in your theme’s (child theme’s if any) functions.php
add_filter( 'fep_eb_email_legends', function( $legends, $mgs, $user_email ){ $legends['cus_group'] = array( 'description' => __('Mail group name', 'front-end-pm'), 'where' => array( 'newmessage', 'reply' ), //where this tag will be used 'replace_with' => ! empty( $mgs->mgs_id ) ? apply_filters( 'fep_is_group_message', '', $mgs->mgs_id ) : '', ); return $legends; }, 10, 3);
Now add {{cus_group}} in email
December 23, 2018 at 3:28 am #20024Andrew PerrymanParticipantHi Shamim,
Cool thanks, that fantastic it works a treat… 🙂
I was about 80% there when I realised I needed to use an apply_filter…
$group = apply_filters( ‘fep_is_group_message’, true, get_message_id() );
But this just gave me 1 or 0.. you saved me a big headache.. lol
Anyway thank you very much.
I replied to you PM message r.e. satBB.
Andrew
December 23, 2018 at 4:35 am #20027Andrew PerrymanParticipantHi Shamim,
Is the ‘where’ section correct in the routine below as it works for a new message in the email prompt and displays ok but when it is piped back via a reply it does not display on a new reply, it look like the return variable is empty unless the ‘where’ section is missing the correct description for ‘reply’?
add_filter( 'fep_eb_email_legends', function( $legends, $mgs, $user_email ){
$legends['cus_group'] = array(
'description' => __('Mail group name', 'front-end-pm'),
'where' => array( 'newmessage', 'reply' ), //where this tag will be used
'replace_with' => ! empty( $mgs->mgs_id ) ? apply_filters( 'fep_is_group_message', '', $mgs->mgs_id ) : '',
);
return $legends;
}, 10, 3);your thoughts..
Andrew
December 23, 2018 at 5:31 am #20030Andrew PerrymanParticipantShamim,
I wonder if the reply is being stripped of the new tag?
just a seed of thought.
Andrew
December 23, 2018 at 5:47 am #20033Andrew PerrymanParticipantShamim,
So after many diferent tests I think the reply tag is not working for some reason..
However the new message tag does only on the first initiate new message.
Andrew
December 23, 2018 at 5:49 am #20036Shamim HasanKeymasterThere is a small bug for reply message in a group. For temporary fix (upto next version release) add following code in your theme’s (child theme’s if any) functions.php
add_action( 'fep_action_message_after_send', function( $message_id, $message, $inserted_message ){ if( $inserted_message->mgs_parent ) { $group = fep_get_meta( $inserted_message->mgs_parent, '_fep_group', true ); if( $group ){ fep_add_meta( $message_id, '_fep_group', $group, true ); } } }, 5, 3 );
December 23, 2018 at 6:00 am #20038Andrew PerrymanParticipantShamim,
You star… ????
Yes that worked for both prompt mails both New message and new reply, well done, I can now safely say this will hopefully eliminate cross talk confusion for all those users that share multiple groups.
I hope you get a good nights sleep..
Andrew
-
AuthorPosts
You need to purchase ‘Front End PM PRO’ to create topic in this support forum.
If you already purchased ‘Front End PM PRO’ please LOGIN.