Forum Replies Created

Viewing 15 replies - 1 through 15 (of 19 total)
  • Thread Starter redrocksrover2

    (@redrocksrover2)

    Marking this as resolved for now as I’ve not been able to repeat the issue and it’s unclear what was causing it.

    Thread Starter redrocksrover2

    (@redrocksrover2)

    Correction: edit line 764.

    Thread Starter redrocksrover2

    (@redrocksrover2)

    I should add: the controlled vocabulary I mentioned is not insignificant– currently it represents about 9,000 individual terms– so replicatiing the hierarchy manually in WP isn’t an option. 😉

    Forum: Hacks
    In reply to: Symbols Appears in my website

    You probably have character encoding issues- likely because your page is currently serving the UTF-7 character set and you’re pasting in characters from another character set. Try setting WordPress and your page header to output UTF-8

    Forum: Hacks
    In reply to: Ajax and multiple nonces
    Thread Starter redrocksrover2

    (@redrocksrover2)

    Thanks for sharing- this helps me a lot- particularly how you regenerate the nonce and send it back.

    I’m curious how you’re storing & referencing your ‘hidden comment ID field’ on the front-end PHP page? Looking at your .js example, I understand the data.split(‘,’) to get the new nonce, but it’s not clear to me what you’re doing in the very last step where you’ve got the ‘replace current value with new…” comment. This last bit is where I’ve been chasing my tail in my own system.

    You should be able to use jQuery’s $.getJSON(my.json)

    The jQuery documentation has a few good examples of traversing through the array to output HTML:
    http://api.jquery.com/jQuery.getJSON/

    If your URL has a callback function you’ll have to use JSONP.

    Forum: Hacks
    In reply to: change password hash

    By default WordPress hashes passwords with 8 passes of MD5.

    See:
    http://codex.ww.wp.xz.cn/Function_Reference/wp_hash_password

    Not sure why you’re trying to redefine the wp_hash_password function. Also not sure why you need to use a different global $wp_hasher setting. Also not sure why you need a separate function at all, but assuming you do, it seems like it should be as simple as:

    function hashMyPassword($plainPassword)
    {
         $hash = wp_hash_password($plainPassword);
         return $hash;
    }

    Then just pass the original, plaintext password into the function and insert the hashed result into your DB:

    $hashedPassword = hashMyPassword('origPlainPassword')

    But you should be able to do it simply with wp_hash_password($plainPassword)

    Forum: Hacks
    In reply to: WordPress image resize hook

    Add the rounded corners with CSS. Instead of creating an image link like:
    <img src="myimage" with="320" height="320" alt="" />

    Insert your image as the background of a <div> or other HTML element, then set the CSS border-radius of that element as you like. The border radius of the element will clip the background image and make it look like your image has rounded corners.

    See:
    http://answers.oreilly.com/topic/1002-how-to-set-a-rounded-border-around-an-image-using-css/

    Also:
    http://caniuse.com/#feat=border-radius

    It’s not clear what you want to do. Are you saying that you installed the plugin into WordPress and you want the output of that plugin to be visible to visitors of your site? Or are you saying that you developed a plugin that you want users of your site to be able to use and access when they create/alter content themselves?

    If you’re simply trying to make the content of an installed plugin visible on your site and it isn’t visible, any number of things could be going on: the plugin may be outdated or coded poorly and thus not outputting content correctly, or you may need to insert custom tags or shortcodes to get the plugin to output as you expect, etc.

    If on the other hand you’ve developed your own plugin and you want to make it accessible to users with the ‘subscriber’ role, that may not be possible depending on the permissions that are required to use the plugin. For example, if your plugin deletes data from your blog, users are likely going to need permissions that are more lenient than the role of ‘subscriber’ (but depending on what you’re trying to do, that might not be desirable or safe – context is everything).

    Depending on what you’re trying to accomplish, query_posts() may not be the best- or preferred- way to get it done. But assuming it is, see below. Also, be sure that the category ID you’re trying to exclude is actually “51” – if it isn’t, this won’t do you any good…

    $args = array(
           'cat' => '-51',
           'posts_per_page' => 10,
           'order' => 'DESC'
    );
    query_posts($args);

    …Then your loop. After your loop, you’ll probably want to reset the query:

    endwhile; // End of the loop
    
    // Reset
    wp_reset_query();

    If you want to display every post in your blog, you can set ‘posts_per_page’ to ‘-1’. Then depending on your theme, you can also paginate the output with ‘paged’ => $paged.

    See: http://codex.ww.wp.xz.cn/Function_Reference/query_posts

    Forum: Hacks
    In reply to: Core Changes for SSL

    @billibones: With regard to the jQuery library links, if you’re doing so, you really shouldn’t manually place jQuery scripts into your templates because they can really screw with WordPress’s own script management.

    See here:
    http://www.ericmmartin.com/5-tips-for-using-jquery-with-wordpress/

    In short: use the wp_enqueue_script(), wp_deregister_script() and wp_register_script() functions to modify and/or add your own libraries, then let WP manage the dependencies. This could help to solve your insecure/non-SSL calls, and it’ll be particularly important if you’re using plugins that rely on jQuery, too.

    Thread Starter redrocksrover2

    (@redrocksrover2)

    @billibones – Thanks for the pointers.

    I’ve been able to get this to work – let’s just say it’s good to pay attention to where the PHP session data is set and regenerated 😉 I had been overwriting my new session data with old variable values. Ahem.

    For others who might be interested:

    1) Out of the box WordPress doesn’t respond to PHP sessions without altering the config.php file or the functions.php file. This article was helpful to me: http://devondev.com/2012/02/03/using-the-php-session-in-wordpress/

    2) Once I had set up functions to start PHP sessions and destroy them on login or logout, I was able to manipulate session variables via $_SESSION['key'] in either my header.php file — or in my particular case where I am processing form data and want the new values submitted by the user to update the session variables — at the top of my form after the $_POST data has been processed, but before WP’s header.php file is output. This way my header.php file picks up the new values of the PHP session variables.

    3) This also gives you the ability to use any of the other PHP session functions such as session_regenerate_id().

    Thread Starter redrocksrover2

    (@redrocksrover2)

    I’m still working on a solution to my question, and it will likely have to include PHP sessions per billibones. WordPress’s internal cache is not persistent from page to page, and the only way to make it so is to use a plugin.

    There are some issues with WordPress and PHP sessions that I’m working around, and once I’ve ironed out what works, I’ll post back. Currently I can set PHP session variables and output them, but regenerating a session with updated variables after submitting a form has been vexing. For some reason WordPress is either holding on to the header data, or I’m not regenerating the session in the right place in my code.

Viewing 15 replies - 1 through 15 (of 19 total)