Viewing 15 replies - 1 through 15 (of 32 total)
  • Plugin Author Mike Walsh

    (@mpwalsh8)

    I am not sure what that means – can you elaborate on what you want to do?

    Thread Starter Andy Fragen

    (@afragen)

    I’m using the Cimy User Extra Fields plugin and I’d like to be able to send email based upon the value of a specific extra field.

    thomaslcq

    (@thomaslcq)

    I’d be interested to have some filter/hook so I could provide custom lists/groups to the plugin, would that be possible? That would be something like

    apply_filters('emailusers_customgroup','mycustomgroups')
    
    function mycustomgroups() {
    
    //build my custom list based on their meta "interest"
    $groups = array(
                array(name=>"Group1", users=> array(id1,id2,id3)),
                 ...
                 )
    return $groups;
    }

    (raw php code, unchecked, but pseudocode ??

    Plugin Author Mike Walsh

    (@mpwalsh8)

    If we’re talking about simply sending an email and not post and/or page notifications, a filter to select the recipients is certainly possible and probably not difficult to implement.

    The challenge becomes how to presented something in the WordPress UI in the general case that would allow the plugin and/or theme to define the subset of users that should be in the recipient list.

    I’ll think about this as I can definitely see an application for it and see what I can do. I’ve got some other things stacked up that I need to finish first but will put this on the to-do list.

    thomaslcq

    (@thomaslcq)

    Great to read so ! I wasn’t really thinking of the wp UI either, but that’s indeed a challenge… I’m more of a hacker, so if a filter is available, my plugin can talk to your plugin ?? But the UI would be interesting for others, surely !

    let me know if you want to have some discussion about it

    cheers,

    Thread Starter Andy Fragen

    (@afragen)

    Just sending an email would be enough for me. A quick search lead me to this, . I don’t know if it’s useful.

    A filter would work for me as well. Thanks for putting it on the todo list.

    Thread Starter Andy Fragen

    (@afragen)

    After digging into this more I think a filter is the simplest way to go. It will be extraordinarily difficult to figure out what someone else’s custom user fields are.

    So a filter sending email to every user with a specific key value pair where the filter would take as parameters the key and an array of values. Then I could select the specific value from my array.

    Pseudo code above would work.

    Thread Starter Andy Fragen

    (@afragen)

    BTW, not using Cimy plugin as it doesn’t create “real” user meta fields.

    Plugin Author Mike Walsh

    (@mpwalsh8)

    I’ve spent some thinking about this and I agree, a filter is probably the best way to do it. I need to finish up a couple other things I am working on before I can tackle this but now that v4.3.15 has been released, this should be next on my to-do list unless I get any other bug reports.

    Thread Starter Andy Fragen

    (@afragen)

    Excellent. Only thing I would suggest would be input array similar to the following.

    array( [meta-field-name] => "Meta Field Label", [meta-field-values] => array('value1,value2,value3) )

    Where meta-field-name is user’s declared meta field name and label is similar to how role currently displayed and meta-field-values is just an unordered array with the values. But obviously the only necessary data is the array of values. Labels just keep it more ordered if lots of meta fields are needed.

    Thread Starter Andy Fragen

    (@afragen)

    Mike,

    I’ve done a bit of testing from my installation. I’ve got a couple of script that should return an array of values for a given custom user meta field and return a array of email addresses for a given custom user meta field and a designated value for this field.

    https://gist.github.com/4137084

    the format for the call is as follows

    get_user_meta_field_values( 'my-custom-meta-field' );
    returns an array of the values for the designated custom user meta field.

    get_email_from_meta( 'my-custom-meta-field, 'custom-meta-value' );
    returns an array of email addresses corresponding to users with that particular custom meta value.

    I hope this helps in some way.

    Thread Starter Andy Fragen

    (@afragen)

    I reworked the script to use a single call with the returned array being different depending upon what variable are passed.

    get_user_meta_field_data( 'my-custom-user-meta-field' ); returns an array with the values of the custom user meta field.

    get_user_meta_field_data( 'my-custom-user-meta-field', my-custom-user-meta-field-value' ); returns an array of email addresses of all users with that particular custom user meta field value.

    Thread Starter Andy Fragen

    (@afragen)

    Hey Mike, any time to think about this?

    Plugin Author Mike Walsh

    (@mpwalsh8)

    Unfortunately I haven’t much time to do anything WordPress related recently. This is a very busy time of the year for me at work so free cycles are few and it will probably stay that way through the end of the month (our fiscal year ends on 1/31).

    Wish I had better news to share. I have 3-4 things I want to implement for Email-Users, this is one of them.

    Thread Starter Andy Fragen

    (@afragen)

    No problem Mike. I just wanted to know if it was still on your radar. I hope the code is helpful.

Viewing 15 replies - 1 through 15 (of 32 total)
  • The topic ‘Email to user meta field’ is closed to new replies.