Extra mail variable request.


Home Forums Front End PM PRO Extra mail variable request.

This topic is: Resolved
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #19983
    Andrew Perryman
    Participant

    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

    #19988
    shamim
    Keymaster
    #20010
    Andrew Perryman
    Participant

    Hi 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

    #20013
    Andrew Perryman
    Participant

    PS..

    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

    #20016
    Andrew Perryman
    Participant

    PPS..

    Plus this will need extra code wrapped around it to identify and to only set the tag if a group is chosen..

    Andrew

    #20019
    Andrew Perryman
    Participant

    PPPS..

    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

    #20022
    shamim
    Keymaster

    add 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

    #20024
    Andrew Perryman
    Participant

    Hi 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

    #20027
    Andrew Perryman
    Participant

    Hi 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

    #20030
    Andrew Perryman
    Participant

    Shamim,

    I wonder if the reply is being stripped of the new tag?

    just a seed of thought.

    Andrew

    #20033
    Andrew Perryman
    Participant

    Shamim,

    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

    #20036
    shamim
    Keymaster

    There 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 );
    
    #20038
    Andrew Perryman
    Participant

    Shamim,

    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

Viewing 13 posts - 1 through 13 (of 13 total)

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.