PHP/html form with mysql query (wordpress 3,5)
-
Here’s my conundrum; to start of with I don’t usually deal with PHP so excuse the ugly code.. I’m trying to retrive a list of WordPress user groups I’ve set up using: https://www.ads-software.com/extend/plugins/groups/ and give the user the ability to email each group indivually, using this plugin: https://www.ads-software.com/extend/plugins/email-users/ basiclly reproducing a listserv. Now after installing both plugins and setting up the list of groups the email plugin was showing the wordpress roles I.E editor/subscriber etc etc not my custom groups. so I’ve opened up the form that sends the group emails heres the orignal trunk: https://subversion.assembla.com/svn/rotarywebproject/trunk/wp-content/plugins/email-users-rwp/email_users_group_mail_form.php Now after hacking away at from line 97 to line 119 I’ve ended up with this:
<select id="send_roles" name="send_roles[]" multiple="multiple" size="8" style="width: 654px; height: 250px;"> <?php $roles = mailusers_get_roles($user_ID, MAILUSERS_ACCEPT_MASS_EMAIL_USER_META); foreach ($roles as $key => $value) { ?> <?php $data = mysql_query("SELECT * FROM wp_groups_group") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { ?> <option value="<?php echo $key; ?>" <?php echo (in_array($key, $send_roles) ? ' selected="yes"' : '');?>> <?php printf('%s - %s', __('Group', MAILUSERS_I18N_DOMAIN), $info['name']); } ?> </option> <?php } ?> </select>
which is great it shows the email form now with my list of user groups the only problem is that no matter which email group I select it always sends the email to all the users in all the groups, after submitting the form the groups show up as all being selected instead of just the group i’ve chosen….. I’m banging my head against the wall with this so if anyone can help I’d be much appreciated!!! Kind regards Chris
- The topic ‘PHP/html form with mysql query (wordpress 3,5)’ is closed to new replies.