Jim R
Members-
Posts
988 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Jim R
-
PHP form: email separate confirmation emails to User and me...
Jim R replied to Jim R's topic in PHP Coding Help
Figured it out. The issue I had was the line you copied last. The $message,70 needed to be $confirm,70. Thanks. -
PHP form: email separate confirmation emails to User and me...
Jim R replied to Jim R's topic in PHP Coding Help
That wraps the email message after 70 characters in the event of a longer message. The $confirm is what I altered from $message for the second email. -
PHP form: email separate confirmation emails to User and me...
Jim R replied to Jim R's topic in PHP Coding Help
The User's email address they use in the form. -
I have an HTML form set up, processed by PHP to enter information into a database and send me a confirmation email. It's worked great for two years, but I'm getting to the numbers where I'd like to have a separate confirmation email sent to the User after they register. Most of what I search for online, here and at PHP Manual sets up sending the same message to multiple people. Here is what I have being sent to me: // Email to me $message = $_POST['nameFirst'] . " " . $_POST['nameLast'] ." has entered the fall league.\n"; $message .= $_POST['feet'] . "'" . $_POST['inches'] ."\", " . $_POST['grade'] . "; " . $_POST['school'] ."\n"; $message .= $_POST['nameParent']."\n"; $message .= $_POST['email']; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70); $headers = "From: " . $_POST['nameFirst'] . " " . $_POST['nameLast'] . " <" . $_POST['email'] . ">"; // Send mail('basketball@metroindybasketball.com', '2012 Fall League Registration', $message, $headers); Below is what I'm trying to send to my Users. I thought changing the variables would create the separate emails, but all I'm getting is the above email twice. // Confirmation email to the player $confirm = "This is to confirm that" . $_POST['nameFirst'] . " " . $_POST['nameLast'] ." has entered the Metro Indy Basketball Fall League.\n\n"; $confirm .= "Thank you for entering. Information on which team your son will be on and any updates will be posted at http://metroindybasketball.com around Wednesday, the week leading up to the start of the league. It starts Sunday, September 30. You may also follow us on Twitter: MetroIndyBBall and search for #MIBFL.\n\n"; $confirm .= "We are looking forward to the start of our sixth season!\n\n"; $confirm .= "Take care,\n\n"; $confirm .= "My Name Goes Here"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $confirm = wordwrap($message, 70); $confirmHeaders = "From: Metro Indy Basketball <basketball@metroindybasketball.com>"; // Send mail($_POST['email'], '2012 Fall League Registration', $confirm, $confirmHeaders);
-
Yeah, thanks. It's little crap like that frustrate me. It still didn't unserialize the data, as it did for $custom, which you helped me with. The code PFMaBiSmAd provided, where would I put that? Just not sure where it fits: SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING(wp_s2member_custom_fields,LOCATE('s:6:"reason";s:',wp_s2member_custom_fields)),'"',4),'"',-1);
-
Before revisited the topic, I tried another shot at it: (no avail) I took what Psycho had helped me with earlier in the year and tried to expand it by adding: // ***** Trying to determine why someone is subscribing $reason = unserialize($row['c_reason']); $user_reason = $reason['reason']; if ($user_reason = "iu") { echo $row['user_login'] . ' '; } // ****** end Reason testing area It just prints all the user names. I figured if it didn't work, it wouldn't print any of them. The entire code is below: $subscriptionLevels = array( 's2member_level3' => 'Yearly', 's2member_level2' => 'Semi-annual', 's2member_level1' => 'Monthly' ); $query = 'SELECT um1.meta_value as custom, um2.meta_value as level, um3.meta_value as c_reason, u.ID, u.user_login, u.user_email FROM wp_usermeta um1 INNER JOIN wp_usermeta um2 INNER JOIN wp_usermeta um3 ON um1.user_id = um2.user_id JOIN wp_users u ON um1.user_id = u.ID WHERE um1.meta_key = "wp_s2member_custom_fields" AND um2.meta_value LIKE "%s2member_level%" GROUP BY um1.user_id'; $result = mysql_query($query); //Process results into temp array $regionData = array(); while($row = mysql_fetch_assoc($result)) { //var_dump($row); $custom = unserialize($row['custom']); $user_region = $custom['county']; $level = unserialize($row['level']); $level_desc = key($level); //E.g. s2member_level3 // ***** Trying to determine why someone is subscribing $reason = unserialize($row['c_reason']); $user_reason = $reason['reason']; if ($user_reason = "iu") { echo $row['user_login'] . ' '; } // ****** end Reason testing area if ($level_desc != "s2member_level4") { $user_level = $subscriptionLevels[$level_desc]; } if(!isset($regionData[$user_region])) { $regionData[$user_region] = array_fill_keys($subscriptionLevels, 0); } $regionData[$user_region][$user_level]++; } //Output the results foreach ($regionData as $region => $data) {if ($region != 0) { echo "<br>Region {$region}<br>\n"; foreach($data as $subscription_type => $member_count) { //var_dump($subscription_type); echo "{$subscription_type}: {$member_count} members<br>\n"; } } }
-
Where would that go in the current code?
-
Does it need to be different from what is above? What I have posted above works perfectly without the extra of trying to figure out why (what they are a fan of) someone is subscribing.
-
I don't know what else to say than what I started the topic with. (Other than saying it creates an ordered list--it doesn't--just the groupings above.) I'm going to have 12 "reasons". For 11 of them, it's going to list the "reason" and break down Yearly, Semi, Monthly. The 12th one is "hsbball", under that "reason" it will continue to print what's above. I figured it would be something like: If "hsball" { what's printed above } else { 11 other reason groups }
-
Just what I have above. I just need to add the extra condition which is part of the serialized data.
-
Can't I just get help on the question I asked? What you linked doesn't apply to my needs, and I'm not the only one asking about serialized data on this forum.
-
And if I knew how to do any of that, I'd do it. I don't know why choose to write it as they did, but it's an extension beyond the core offering of the plugin. I also don't know how to rewrite the plugin so upon creating custom registration fields, instead of producing serialized data, it creates new data table columns and populates them accordingly. It's a WordPress plugin. If there is a plugin that creates custom registration fields and use their own columns for data, that would be awesome. However, right now what I'm using is part of a great User Management plugin that also happens to let me create custom registration fields. I don't think they planned on anyone using it as narrowly as I'm trying to. That said, I need help with my extra level of sorting. :-)
-
I don't mean to sound dismissive, but I think I had this discussion the last time. That's how a very robust payment/User management plugin I'm using inputs the data into the datatable for custom registration fields. I actually wrote the query, but it's been awhile, and I couldn't get it to output as I wanted it to. After looking at it for a couple of days, I can't wrap my head around adding the extra trigger/condition/etc. to sort and group Subscribed Users.
-
I'm weak with serialized data. The code below is also through a lot of help on here, and it queries two rows from the same data table for each User. I need to add an extra layer or trigger to my output. Right now the code determines: 1) Determine who has subscribed 2) Among subscribers, which region they live in relative to their county of residence. It generates an ordered list: $subscriptionLevels = array( 's2member_level3' => 'Yearly', 's2member_level2' => 'Semi-annual', 's2member_level1' => 'Monthly' ); $query = 'SELECT um1.meta_value as custom, um2.meta_value as level, u.ID,u.user_login, u.user_email FROM wp_usermeta um1 INNER JOIN wp_usermeta um2 ON um1.user_id = um2.user_id JOIN wp_users u ON um1.user_id = u.ID WHERE um1.meta_key = "wp_s2member_custom_fields" AND um2.meta_value LIKE "%s2member_level%" GROUP BY um1.user_id'; $result = mysql_query($query); //Process results into temp array $regionData = array(); while($row = mysql_fetch_assoc($result)) { //var_dump($row); $custom = unserialize($row['custom']); $user_region = $custom['county']; $level = unserialize($row['level']); $level_desc = key($level); //E.g. s2member_level3 if ($level_desc != "s2member_level4") { $user_level = $subscriptionLevels[$level_desc]; } if(!isset($regionData[$user_region])) { $regionData[$user_region] = array_fill_keys($subscriptionLevels, 0); } $regionData[$user_region][$user_level]++; } //Output the results foreach ($regionData as $region => $data) {if ($region != 0) { echo "<br>Region {$region}<br>\n"; foreach($data as $subscription_type => $member_count) { //var_dump($subscription_type); echo "{$subscription_type}: {$member_count} members<br>\n"; } } } What I need it to do is: 1) Determine who has subscribed (which it already does) 2) Determine what they are a fan of (reason) high school basketball or any of 10 colleges in Indiana 3) If they are a fan of any of the colleges, group them accordingly 4) If they are a fan of high school basketball "hsbball", group them according which region they live in Below are the two rows of data for each User is queried. There are 12 different "reasons", determined in the first row. In the second row, that's what determines if a User has subscribed. I have that part taken care of above. meta_key meta_value wp_s2member_custom_fields a:2:{s:6:"reason";s:2:"ue";s:6:"county";s:1:"4";} wp_capabilities a:1:{s:15:"s2member_level2";s:1:"1";}
-
Never mind, I found the original set of posts helping me figure it out.
-
I had created this plugin with some help here, but somehow it's been lost from my local drive and server (computer change, as well as an unrelated accidental deletion of files from my server). Here is what I'm trying to do: Author writes Post and puts in Tags (usually names of basketball players). Plugin gets the Tag ID and Slug. Plugin copies the Tag ID to the matching name in a separate data table. I've activated the plugin and tested it. I'm not getting any errors, but it's not updating the other data table. function save_post($post_ID) { mysql_select_db("jwrbloom_hhr"); $wp_tagID = get_query_var('tag_id'); $wp_slug = get_query_var('tag'); $query ="UPDATE wp_playerRank SET wpID = '$wp_tagID' WHERE wpSlug = '$wp_slug'"; return $post_ID; } add_action('publish_post', 'save_post');
-
var_dump giving me a bool(false), but I'm not sure why...
Jim R replied to Jim R's topic in PHP Coding Help
Ok...that may explain the var_dump, but I'm still not getting the same result on my page query vs. the query made in my MySQL program. I moved the var_dump up higher and get this: resource(352) of type (mysql result) -
var_dump giving me a bool(false), but I'm not sure why...
Jim R replied to Jim R's topic in PHP Coding Help
It is my second usage of mysql_fetch_assoc in the file. I'm a tweaker, not a coder. *shocking, right? * I've never really gotten a grasp of which function to use after my queries, so I basically just use that one. Once I was told to "reset the pointer" on another issue awhile ago. Is that my issue now? -
It's a WordPress site, but this still seems more like a PHP/MySQL issue rather than a WordPress issue. I'm trying to match Images (ngp.pid) tags (tr.object_id) that share the same ID's. The Images matched have to then share the same ID as $wp_tagID, which the Page gets based on whatever link my user clicks. From there I want to print what I have to the screen. Here is the test screen: http://hoosierhoopsreport.com/tag/Michael-Volovic/ (All the information above the HR is from a database, linked to $wp_tagID, so I know that part of it is working.) Clicking on his link, carries a $wp_tagID of 677. When I test my query in my MySQL program and just use 677 (as $wp_tagID) it works. I get five images that share the same link of this basketball player. The second var_dump is producing a false result on the actual page. Not sure why. $qImage = ' SELECT * FROM wp_terms AS t JOIN wp_ngg_gallery AS ngg JOIN wp_term_taxonomy AS tt JOIN wp_term_relationships AS tr JOIN wp_ngg_pictures AS ngp WHERE t.term_id = tt.term_id AND ngg.gid = ngp.galleryid AND tt.term_taxonomy_id = tr.term_taxonomy_id AND tr.object_id = ngp.pid AND tt.taxonomy = "ngg_tag" AND t.term_id = "$wp_tagID" LIMIT 5'; // AND t.term_id = "$wp_tagID" $pImage = mysql_query($qImage); while($image = mysql_fetch_assoc($pImage)) { foreach ($image as $images) { echo '<img src="http://hoosierhoopsreport.com'. $images['path'] .'/'. $images['filename'] .'>'; } } var_dump($wp_tagID); var_dump($image);
-
Hoping someone can give this a look. Thank you.
-
Here is the sample page: http://hoosierhoopsreport.com/pg-test/ Trying to create a table that has three sections (groupings). That part I have figured out. The first grouping is sorted numerically. The second group is sorted alphabetically based on what part of the state they live in. It's breaking down this second part that I can't seem to get. (The third group is just what's left over, sorted alphabetically.) So it needs to look like this: (Each group and region have their own header row. Only Group 2 is broken down into Regions.) Group 1 Group 2 -Region 1 -Region 2 -Region 3 -Region 4 -Region 5 Group 3 The sample page above, in Group 2, it just shows Region 1 header. $query = 'SELECT * FROM a_playerRank WHERE year="2015" and position="1" ORDER BY grouping DESC,rankPos,region,nameLast'; $results = mysql_query($query) or trigger_error('MySQL error: ' . mysql_error()); $currentGrouping = false; $currentRegion = false; while($line = mysql_fetch_assoc($results)) { if($currentGrouping != $line['grouping']) { //Status has changed, display status header $currentGrouping = $line['grouping']; if($line['grouping']==2) { echo '<thead> <tr> <th class="num">#</th> <th class="top">Top 10</th> <th class="height">HT</th>'; if (current_user_can("access_s2member_level4")){ echo '<th class="level">Level</th>'; } echo' <th class="school">City (School)</th>'; if (current_user_can("access_s2member_level4")){ echo '<th class="summer">Summer Team</th>'; } echo' <th class="college">College</th> </tr> </thead>'; } if($line['grouping']==1) {echo '<tr><th colspan="7">Best of the Rest</th></tr>'; if($currentRegion != $line['region']) { $currentRegion = $line['region']; echo '<tr><th colspan="7">Region' .$line['region'] . '</th></tr>';} } if($line['grouping']==0) echo '<tr><th colspan="7">Names to Know</th></tr>'; }
-
My apologies. I typed the wrong URL. It shows: http://metroindybasketball.com #3 (line 101). I have since drilled down the to the div ID #top, which worked, but in other instances on other sites, I haven't been able to effectively produce what I want. How would I find that line?
-
That didn't work because it's being overridden by the http://hoosierhoopsreport.com #3 line 31 style. There is no such line of code that even matches the style. It wasn't a file name. @jesirose, same thing...regular styling for body wasn't working, as it was overridden by the above. I was able to drill down to the div ID, and that worked. I'm surprised, but it works.
-
Using Firebug to find the style of a certain part of my WordPress theme, it shows the file as my URL http://hoosierhoopsreport.com with a #3 after it and a line number. Where do I find that? I see that a lot actually in various themes. I search all the files and can never the appropriate code. I need to change the body background, and using the override method isn't working. body[style]= #000099 !important; I've also tried it with the semi-colon after the hex code.
-
True ...but when I set up the form, I wasn't really into databases. I copied entries on to a spreadsheet as they came in. (It's a week long contest.) Their team number and record were just visually part of the answer. Their record is more of an aid to the User, and the team number is also just a reference, indicating where they are in a bracket. I'm OK with that all being part of the answer for now. I'm not really displaying anything beyond the number of correct choices after it's over, and perhaps the number of Users who picked certain teams. Going forward, I'd create a more dynamic form, but for now it's in HTML. Do I need to convert it to php to create the array need to insert into a database?