Jump to content

maxxd

Gurus
  • Posts

    1,662
  • Joined

  • Last visited

  • Days Won

    52

Posts posted by maxxd

  1. Barand is correct about why your click event isn't triggering, but you can still assign the handler on page load using .on(). For instance

    $(document).on('click','form-submit',function(){ ... });
    

    Side note: most of the time it works if you just attach the on to the specific DOM element, but sometimes you have to attach it to document and specify the DOM element in the function call. I'm sure there's a good reason for it, but I've never been able to figure it out...

  2. CRON jobs are set to run at set times of day (for instance, 15 minutes after every hour, or 7 minutes after every third hour. or 12:15), so when your user creates the e-mail and sets up the send time you can either present them with a drop-down of acceptable times, or set up your select in the script that's going to be run via CRON with a time range.

     

    Obviously the first suggestion is going to be more specific and truthful to your end user - if a user schedules a message to be sent in 10 minutes, but they schedule it at the beginning of the 15-minute select range, the CRON script will pick it up and send the message immediately, which is not the desired action.

     

    Please note that this is a ridiculously simplified 'explanation' of how CRON works and what type of schedules you can create with it.

  3. Hang on, I'm confused (proving Csharp's point in the process).

     

    So, you want to allow a single user to register multiple cell numbers? What does that have to do with green cards or passports? If you're attempting to associate multiple cell phones with a single user, break the cell phone number column out into a separate table and link the records via the auto-incremented user ID from your user table. This user ID won't be a green card number or passport number or even cell phone number, but an internal, database-generated identification number that the end user never sees - it's used specifically for linking records between tables (for instance, the user and cell phone tables), and ensuring that whatever action you're about to perform on a record in the table is being performed on the correct record.

     

    You could even add another column to the user table that specifies what type of number the user is using for the public-facing identification (cell phone, green card, passport, library), which might make whatever logic you're using a bit more transparent.

  4. You'll want to set up a CRON job to take care of this. Basically, you save the e-mail information and the time the user wants to send the email into a database table, write a script that pulls all the messages that haven't been sent yet but are scheduled to send now(ish), and send them. You then schedule a CRON on the server to run every 15 minutes or so that runs this script.

     

    I'm not sure I'm explaining this terribly well (sorry), but Google CRON jobs and that should get you moving in the right direction.

  5. Try dumping the contents of $post after the query is run, and the value of $args after the explode() call ($args is just what I called the resulting string, btw). Make sure it's actually got all the correct information and that the information is formatted properly. Also, make sure you've got error reporting turned on.

  6. Couple things right off the bat - I'm not sure where $property_title is being assigned, but unless it's escaped elsewhere you're leaving yourself open to SQL injection. Also, are you printing the post_ids as a test or are you attempting to create the string as grissom suggests? Give this a shot -

    $post = $wpdb->get_results($wpdb->prepare(
    	"SELECT	 post_id
    	 FROM sw_images_upload
    	 WHERE property_title = %s",
    	 $property_title
    ), ARRAY_N);
    if($post){
    	$args = implode(',',$post);	//concatenate the results into a string, each value separated by a comma
    }
    echo do_shortcode("[gallery include='{args}']");
    

    Basically, this is using WordPress's version of a prepared statement (not a true prepared statement, but at least you're not putting $_REQUEST data directly into a query) to return a numerically indexed array of post_ids that match your property_title. implode() is base php that does exactly what grissom suggests about making the array a string. Then you inject that string into your shortcode.

     

    I don't guarantee this will work if it's just cut and pasted into the functions file, but hopefully it'll point you in the right direction.

     

    Oh - and also, please use the code button ("< >") on the editor to post code. It makes it much more readable.

  7. Assuming the boss info is stored in another table in your database, you'll want to join the tables in your query. So, basically, if the table 'raidboss_spawnlist' contains the columns boss_id and respawn_time and table 'boss_information' contains the columns boss_id and boss_name, you'd join the two on the column boss_id (it's a foreign key) like this:

    SELECT	 b.boss_name
    	,a.respawn_time
    FROM raidboss_spawnlist a
    LEFT JOIN boss_information b
    	ON a.boss_id = b.boss_id
    ORDER BY respawn_time DESC
    

    Of course, this is all moot if you don't have the boss information set up in a separate table; however, if you don't then you should reconsider your database design.

  8. You're not separating the numbers. If you look at your example, you've got

    [gallery include="499,496"]
    

    but your built string is reading

    [gallery include="499496"]
    

    Try changing the do_shortcode() call to

    echo do_shortcode("[gallery include='{$image1},{$image2}']");
    

    Note the comma separator between the variables.

    • Like 1
  9. It's difficult to tell with the formatting of the code, but I think you may be missing an endif; at the end of your code. You've got

    if(comments_open()){

    followed by

    if (get_option(THEMEPREFIX.'_fb_comments') != "true" ) : comments_template(); 
    else : ?>
    

    but then only one 'endif;'.

     

    Again, given the formatting it's difficult to tell (and I hate how much WP encourages mixing PHP and HTML and the if(): endif; syntax, but that's neither here nor there), but that could be it. I'm assuming you can't remember exactly what it was that you changed?

  10. There are several issues with the code you've posted, actually. First and foremost, your quote nesting is incorrect and you're leaving plaintext strings in the middle of the echo statements. Also, the php open/close tags don't match up in several places.

    <?php
    if ( is_single() ) { 
    	echo "<div class='pagelink'>".wp_link_pages('pagelink=trang %')."</div><p>";
    	echo "<div class='fb-like' data-href='https://www.facebook.com/tvvn.net' data-layout='standard' data-action='like' data-show-faces='false' data-share='true'></div><p>";
    	if(function_exists("kk_star_ratings")){
    		echo kk_star_ratings($pid);
    	}
    	echo "<p>".do_shortcode("[kpvc_single]");
    	echo "<p>".do_shortcode("[fbcomments]")."<p>";
    	zemanta_related_posts();
    } else {}
    ?>
    

    This just fixes the syntax errors in the code you posted - there's no logic work done in the above. For instance, I'm not seeing where $pid is being defined, so if it's not done somewhere higher up in the script, you'll get an undefined error assuming that function kk_star_ratings() exists. I'm not familiar with the Zemanta Related Posts plugin, so I don't know if zemanta_related_posts() will display to screen without an explicit echo statement.

  11. It looks like there's a setting panel somewhere that allows you to set the height and width of the logo image? (I'm basing this off the calls to it_get_setting() using 'logo_width' and 'logo_height').

     

    If this isn't actually what's happening, you should be able to override the sizing of the image via CSS like this:

    #site-logo,
    #site-logo-hd{
    	width:150px !important;
    	height:150px !important;
    }
    
  12. If I'm reading your question correctly, you're going to want to look into the GROUP BY clause. Something along the lines of

    SELECT	 a.city_name
    	,SUM(b.citizens) AS numCitizens
    FROM table1 a
    LEFT JOIN table2 b
    	ON a.cityID = b.cityID
    GROUP BY numCitizens
    

    No guarantee this will work if you copy and paste it (I'm only on my second up of coffee this morning), but it should get you moving in the right direction. Also, note that this assumes a foreign key of cityID in both table1 and table2 which you use to make the join.

  13. I've given it a name attribute and an id of "fruitid" and now the array is Array ( [fruitid] => 9 [submit] => Submit ) how can i fix this please help

     

    Also note that PHP will index both the $_GET and $_POST arrays by the HTML 'name' attribute. So, if you have

    <input type='text' name='a_text_box' id='my_name_is_earl' value='yuuuuuup' />
    

    You would access that field using $_POST['a_text_box'], and it would print 'yuuuuuup'. However, attempting to access $_POST['my_name_is_earl'] will return an error, as that index does not exist in $_POST after submitting your form.

  14. I have used "print_r($_POST);" which printed and array of the select data and in displays the fruitid in the array which is 9.  Array ( [select] => 9 [submit] => Submit )

     

    If this is the exact output from print_r($_POST), then there's an issue. The index is not 'fruitid', it's 'select'. When you view the HMTL source of your page, does the hidden field show the correct fruit id value? Try giving your select element a name attribute, and run 'print_r($_POST,true);' again and see what it has to say.

  15. It would be very good to know what exactly isn't working, but in the meantime you need to set up error checking on your queries. Don't just blindly assume that the query executed properly. Turn on error reporting and set up some checks on those queries - I'll bet that'll tell you pretty much exactly what's going wrong.

  16. If you've got the shadow set up as a separate div or span in your navigation, wright67uk is correct about just turning the display off. If it's set up as a style on, say, a list item element, you'll have to turn it off property by property at the lowest screen width you want to display it. As an extraordinarily simple example,

    #nav li{
    	font-size:1.25em;
    	text-shadow:2px 2px rgba(0,0,0,.4);
    }
    @media screen and(max-width:640px){
    	#nav li{
    		text-shadow:none;
    	}
    }
    

    So, when the screen is under 640 pixels wide, there won't be a text-shadow in the #nav menu list items. Above 640 pixels, the line item has text shadows.

×
×
  • 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.