Jump to content

Jim R

Members
  • Posts

    988
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Jim R

  1. Try this plugin: http://wordpress.org/extend/plugins/google-calendar-events/ It should give you the flexibility you need. I don't use the grid version, but I have modified the list version to suit my needs. It does use shortcodes, so check out the linked page or the plugin's developer home page.
  2. This is code being used to direct PayPal to create a subscription. It's going on a PHP page used in WordPress. The first section of code is what shows up on my end locally. The bottom set is what shows up when I view the source code in the browser. It's turning the element of each comment that closes the comment into –, and it adds line breaks. It's a theme issue, not a WordPress issue, as I've used this code on previous themes and another site. It still works in each instance. The theme producer is working with me on this, but his initial effort was replacing the style.css file. This is what I'm pasting: <!-- Customizes Prices, Payments & Billing Cycle --> <!--<input type="hidden" name="amount" value="8.00" />--> <input type="hidden" name="src" value="1" /> <input type="hidden" name="srt" value="" /> <input type="hidden" name="sra" value="1" /> <!--<input type="hidden" name="a1" value="0" />--> <!--<input type="hidden" name="p1" value="0" />--> <!--<input type="hidden" name="t1" value="D" />--> <input type="hidden" name="a3" value="8.00" /> <input type="hidden" name="p3" value="1" /> <input type="hidden" name="t3" value="M" /> </form> This is what shows up: <!--<input type="hidden" name="amount" value="8.00" />–><br /> <input type="hidden" name="src" value="1" /><br /> <input type="hidden" name="srt" value="" /><br /> <input type="hidden" name="sra" value="1" /><br /> <!--<input type="hidden" name="a1" value="0" />–><br /> <!--<input type="hidden" name="p1" value="0" />–><br /> <!--<input type="hidden" name="t1" value="D" />–><br /> <input type="hidden" name="a3" value="8.00" /><br /> <input type="hidden" name="p3" value="1" /><br /> <input type="hidden" name="t3" value="M" /><br /> (There was an initial issue of the extra line breaks causing white space problems. His style.css solved that. I've only been using this theme for a couple of weeks. I put the original style.css back in to see if the PayPal buttons worked. They didn't.)
  3. The redirect isn't working from within the loop.
  4. I moved the redirect (back to the entry page) into the 'else' part of the loop, so that eliminates the warning when the entry already exists. I'd like it to redirect (back to the entry page) even if the user inputs a name already in my database.
  5. I have a form set up to enter names into a database. If the name already exists, it should produce a message telling us that. When I submit that doesn't exist, it works just fine. When I test it with a name that meets the criteria I have set up, it produces "This player is already in the database," as it should, but I get the following warning. Warning: Cannot modify header information - headers already sent by (output started at /home/jwrbloom/public_html/resources/playerEntry/dbEnter.php:31) in/home/jwrbloom/public_html/resources/playerEntry/dbEnter.php on line 76 (76 is the last line of code) It does follow through and email me too. (I haven't tried to alter that yet.) $nameFirst = $_POST['nameFirst']; $nameLast = $_POST['nameLast']; $cityHome = $_POST['cityHome']; $school = $_POST['school']; $year = $_POST['year']; $position = $_POST['position']; $feet = $_POST['feet']; $inches = $_POST['inches']; $level = $_POST['level']; /* search for existing row */ $sql = "SELECT id FROM a_playerRank WHERE nameFirst='".mysql_real_escape_string($nameFirst)."' AND nameLast='".mysql_real_escape_string($nameLast)."' AND school='".mysql_real_escape_string($school)."'"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } if(mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); /* This tells us we already have him. */ {echo 'This player is already in the database.'; } } else { /* insert new row */ $sql = "INSERT INTO a_playerRank SET grouping='4', nameFirst='".mysql_real_escape_string($nameFirst)."', nameLast='".mysql_real_escape_string($nameLast)."', city='".mysql_real_escape_string($cityHome)."', school='".mysql_real_escape_string($school)."', year='".mysql_real_escape_string($year)."', position='".mysql_real_escape_string($position)."', feet='".mysql_real_escape_string($feet)."', inches='".mysql_real_escape_string($inches)."', level='".mysql_real_escape_string($level)."'"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } } // Email to me $message = $_POST['nameFirst'] . " " . $_POST['nameLast'] ." was added to the database.\n"; $message .= $_POST['feet'] . "'" . $_POST['inches'] ."\", " . $_POST['year'] . "; " . $_POST['school'] ."\n"; $message .= $_POST['position']."\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: HHR Database Entry <noreply@hoosierhoopsreport.com>"; // Send mail('basketball@hoosierhoopsreport.com', 'Player database addition', $message, $headers); /* redirect user */ header("Location:http://hoosierhoopsreport.com/dbpe");
  6. I searched, and there isn't much and nothing really current. Is there a code that I could use to hide specific content based on what device my User is using? Specifically, if the the User is using a mobile phone browser. Something along the lines of: if ( !is_mobile( ) ) { } I've tried this, but it didn't work.
  7. Using WordPress, I wonder if that messes with how it processes the PHP within Posts and Pages. WordPress doesn't inherently let Users use PHP within Posts and Pages. There are a few good plugins that allow that, some using short code syntax, others just letting the User us normal PHP tags. Most (any that I would use) let the Admin determine who can use PHP in Posts, and in this case, just me.
  8. @ManiacDan, I was looking for general advice from someone who might've experienced this in the past. I could've said the tabs had nothing to do with it because it was doing it before I added the tab short code.
  9. I found the solution. I had some meta data on the files for the INCLUDE. Deleted all the normal HTML stuff that heads off a html file, and it solved my spacing issue.
  10. http://metroindybasketball.com/fall-league-2012/ Check out the tabbed content. Under Standings and Schedule, both are information from INCLUDEd php files. Using Firebug, it reveals there is a <p> and three <br />'s that I didn't add. They only show up when I put in the INCLUDE. How do I go about getting rid of that? I don't see that it's part of the page code.
  11. I did that, and I still wasn't getting it figured out. Why wouldn't someone such as myself not start by taking something that provided the correct result and try to apply to the next, similar problem? The reality was, not only did it work in the previous instance on the same page, it was derived here with Psycho's help. Once I changed the quotes and removed the var_dump, it worked, at least in terms of structure. Now I'm trying to figure out how get the $collegeSubs array to print out instead of the abbreviations. (That's not reflected in the code presented thus far.) Another pesky foreach loop I suppose, but I keep getting invalid arguments.
  12. Ooops...looks like the var_dump broke the loop.
  13. Ok...single quotes instead of double quotes. Now it just prints the last instance.
  14. That doesn't really help me. I've already long since searched and read that.
  15. Commenting out the {if ($reason) loop. It's not carrying forward the values, despite showing up in the var_dumps. echo '<div class="reason"><p>'; var_dump($reasonData); foreach($reasonData as $reason => $reasData) echo '<p>' . var_dump($reason) . ' ' . var_dump($reasData) . '</p>'; //{if ($reason !=0) { // var_dump($reasData); echo 'College {$reason}<br>\n'; foreach($reasData as $subscription_type => $member_count) { echo '{$subscription_type}: {$member_count} members<br>\n'; } } //} echo '</p></div>';
  16. Below is the screen with var_dump($reason) and var_dump($reasData).
  17. You asked why I started with the {. I told you why. You told me I didn't know what I was doing. I agree. I did post the entire contents of the screen and noted in my reply there was no change in eliminating the brackets. You were posting as I was editing. What I saw in the PHP Manual shows braces after the foreach line, so I would assume based on PHP Manual, the syntax the another mod HERE helped me come up with is accurate. So, I'm back to my initial problem. I took what worked in the section above and tried to use it to get a similar output with different variables. It doesn't work, which is why I'm here. Can you help me do that? :-)
  18. It tells me it doesn't work, and when that syntax worked above, I went with it. I have not problem stipulating I don't know code very well. That's why I'm here. I didn't come here asking for anyone to write it. I'm trying to get at why it's wrong or not working. I removed the brace as you suggested. It gave me an error. :-) I removed the ending brace, and it didn't change my result beyond not having the error anymore. Perhaps it was originally a mistake, as I also took it off the section above, which had no change to my results, but that code was provided by one of the mods here. And for what it's worth, the PHP Manual shows the syntax as: foreach ($arr as &$value) { $value = $value * 2; }
  19. I took the bracket away and got an error. It's the exact same syntax as the section above, which worked, not only in terms of results but also relative to syntax.
  20. Because that's how the part above was coded just after the 'foreach'. It worked in determining Regions, so I tried to copy it for the Reasons(colleges). :-)
  21. When I put right after the foreach, I get the following: So I am getting something. foreach($reasonData as $reason => $reasData) echo '<p>' . var_dump($reason) . '</p>'; {if ($reason !=0) { echo 'College {$reason}<br>\n'; foreach($reasData as $subscription_type => $member_count) { echo '{$subscription_type}: {$member_count} members<br>\n'; } } } echo '</p></div>';
  22. var_dump($reason) produces nothing, which I presumed would be the case. The top section worked, and I tried to 'port it' to the second section, changing the variables as I felt were appropriate, but it didn't work. I can't always/usually get my head wrapped around foreach loops.
  23. Keep in mind, I've tried the variables with alias and without. No effect since none of the columns are redundant.
  24. The top portion came with help from here. I added the var_dump above it to show that the var_dump I'm getting on the second part appears to be working at least to that point. I have taken the first part and tried to duplicate it for the second part. The problem with the second part comes in that it doesn't print out. Here is the output: Here is the code: <link href="/styles/regions.css" rel="stylesheet" type="text/css" /> <?php mysql_select_db("jwrbloom_hhr"); $subscriptionLevels = array( 's2member_level2' => 'Yearly', 's2member_level1' => 'Semi-annual' ); // These are the Reasons. Users decide if they are high school fans or fans of colleges. If they are hsbball fans, they go in part one and are divided up by Region and subscription level. (That is working fine) If they are fans of the others, they go into part two and divided up by subscription level. $collegeSubs = array( 'hsbball' => 'High School', // actually, if they are hsbball, they are in the first part the rest are divided up for the second part 'bsu' => 'Ball State', 'bu' => 'Butler', 'cross' => 'Crossroad Conference', 'ue' => 'Evansville', 'glvc' => 'Great Lakes Valley', 'iu' => 'Indiana', 'ipfw' => 'IPFW', 'iupui' => 'IUPUI', 'isu' => 'Indiana State', 'nd' => 'Notre Dame', 'pu' => 'Purdue', 'valpo' => 'Valparaiso' ); $query = 'SELECT um.meta_value as level, um.meta_key, u.* FROM wp_usermeta AS um JOIN wp_users AS u ON um.user_id = u.ID WHERE u.region IS NOT NULL AND u.reason IS NOT NULL AND um.meta_value LIKE "%s2member%" GROUP BY u.ID asc ORDER BY reason,region,user_login'; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { $user_region = $row['region']; $user_reason = $row['reason']; // Keep this - This determines the subscription of level of the user $level = unserialize($row['level']); $level_desc = key($level); //E.g. s2member_level3 if ($level_desc != "s2member_level4") { $user_level = $subscriptionLevels[$level_desc]; } // This ends the subscription level of the user // Here we start to figure out how many subscribe to each level for the first part if($user_reason == 'hsbball') { if(!isset($regionData[$user_region])) { $regionData[$user_region] = array_fill_keys($subscriptionLevels, 0); } $regionData[$user_region][$user_level]++; //end if } // Here is where we start to figure out how many subscribe to each level in the second part elseif($user_reason !='hsbball') { if(!isset($reasonData[$user_reason])) { $reasonData[$user_reason] = array_fill_keys($subscriptionLevels, 0); } $reasonData[$user_reason][$user_level]++; //end else } } //Output the HS Region results (first part) This is the part that works. echo '<div class="region">'; var_dump($regionData); 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"; } } } echo '</div>'; //Output the College results (second part) None of this shows up beyond the var_dump. REGIONS aren't used here. echo '<div class="reason"><p>'; var_dump($reasonData); // This shows the data similarly to the first part above foreach($reasonData as $reason => $reasData) {if ($reason !=0) { echo 'College {$reason}<br>\n'; foreach($reasData as $subscription_type => $member_count) { echo '{$subscription_type}: {$member_count} members<br>\n'; } } } echo '</p></div>'; ?>
  25. Like I said, when I changed $confirm = wordwrap($message, 70); to $confirm = wordwrap($confirm, 70); It worked. I changed the language of the email's body, but here is the code for the second email being sent: // Confirmation email to the player $confirm = 'Hello, This is to confirm that ' . $_POST['nameFirst'] . ' ' . $_POST['nameLast'] .' has entered the Metro Indy Basketball Fall League. Thank you for entering. If you have not paid yet, you can do so at http://metroindybasketball.com/payment. Information on which team your son will be on and any updates will be posted at http://metroindybasketball.com, or you can also follow us at Twitter: @MetroIndyBBall or follow the search term #MIBFL. If you would like to see a list of those who are committed to play, you can check that out at http://metroindybasketball.com/committed. The #MIBFL starts Sunday, September 30, and runs through Sunday, October 28. We will post rosters the week leading up to the first day, likely on that Wednesday. Once the league starts, the website is also where you will find results. We are looking forward to the start of our sixth season! Thank you again for registering, Name Here'; // In case any of our lines are larger than 70 characters, we should use wordwrap() $confirm = wordwrap($confirm, 70); $confirmHeaders = "From: Metro Indy Basketball <basketball@metroindybasketball.com>"; // Send mail($_POST['email'], '2012 Fall League Registration', $confirm, $confirmHeaders);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.