Forum Replies Created

Viewing 15 replies - 106 through 120 (of 145 total)
  • There’s a plugin called Add Signature that adds a signature to the end of posts. I have edited it for my own use to add the beginning of the post (after the title but before the post content). If you’d like I can send you my version.

    – Dave

    Thread Starter golddave

    (@golddave)

    Nobody wants to take a crack at this?

    <?php global $user_identity;
    get_currentuserinfo();

    if ($user_identity == ”) {
    echo(‘Welcome Guest’);
    } else {
    echo(‘Welcome <b>’ . $user_identity . ‘</b>’);
    }
    ?>

    Placing the following code into your template in the place you want to display your users name:

    <?php global $user_identity;
    get_currentuserinfo();

    if ($user_identity == ”) {
    echo(‘Welcome Guest’);
    } else {
    echo(‘Welcome ‘ . $user_identity);
    }
    ?>

    I can make this into a sidebar widget if that’s how you’d like to use it.

    I have completed this plugin. I call it the GMail Player Widget. It’s a sidebar widget that allows you to designate the URL of an audio file (through the WordPress admin interface) and plays it in the Gmail audio player.

    For more information and to download got to https://nothing.golddave.com/?page_id=70

    Now that I’ve been thinking about it I think I have an idea. I could create a plugin that would put the Gmail MP3 player onn the blog (by putting a small function code in your template and/or as a widget) and give you an options page in the WordPress backend to edit MP3_URL. I’ll start working on it today.

    I don’t know if this can be done. Is this something you do now on a manual basis? If yes then please share how you are doing it and maybe I could figure something out.

    Thread Starter golddave

    (@golddave)

    Sorry it’s taken me so long to get back to this. I don’t normally go back to my resolved issues but accidentally clicked and saw a comment. So here’s my solution.

    I used CURL. CURL is a PHP library that “allows you to connect and communicate to many different types of servers with many different types of protocols”. With CURL I wrote the function below.

    function download($sourcefile, $filename) {
    $useragent=”user agent string”;
    $refferer=”refferer string”;
    // create a new curl resource
    $ch = curl_init();

    // set URL and other appropriate options
    curl_setopt($ch, CURLOPT_URL, $sourcefile);
    curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
    curl_setopt($ch, CURLOPT_REFERER, $refferer);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    set_time_limit(300); # 5 minutes for PHP
    curl_setopt($ch, CURLOPT_TIMEOUT, 300); # and also for CURL

    $outfile = fopen($filename, ‘wb’);
    curl_setopt($ch, CURLOPT_FILE, $outfile);

    // grab file from URL
    curl_exec($ch);
    fclose($outfile);

    // close CURL resource, and free up system resources
    curl_close($ch);
    sleep(10);
    return true;
    }

    Thread Starter golddave

    (@golddave)

    I’ve tried to pull out the progress bar code from wp-db-backup.php but I can’t get it to work.

    Thread Starter golddave

    (@golddave)

    I ended up figuring this one out on my own. Here’s the code I used:

    global $wpdb;
    $result = $wpdb->get_row(“SELECT * FROM $wpdb->posts WHERE post_content = ‘< ?php if(function_exists(MyFunction)) MyFunction(); ?>'”, ARRAY_A);
    $new_time = date(“Y-m-d H:i:s”);
    $pageid = $result[‘ID’];
    $wpdb->query(“UPDATE $wpdb->posts SET post_date = ‘$new_time’ WHERE ID = ‘$pageid'”);

    Thread Starter golddave

    (@golddave)

    It’s an options page. You click Options and then select the options page from the list of links along the top of the page.

    Thread Starter golddave

    (@golddave)

    Great!! That worked! Thanks.

    Is there any way to work the same kind of magic from an Admin page? If you change an option from the admin page I’d like it to change the post_date for any post (or page) that calls the plugin. Is there a way to do this? Maybe a quick way to search the contents of every post whet the plugin function is called within post_content and then update post_date for each of them? Or maybe another method?

    I know it’s asking much but I have to ask.

    Thread Starter golddave

    (@golddave)

    Let me try that again since my last reply was silly.

    This is part of a plugin. The plugin is called by putting a call to the function in a page or post as follows:
    < ?php if(function_exists(MyFunction)) MyFunction(); ?>
    I’d like to change post_date for the post or page that is calling the function. Right now I’m using the code suggested by filosofo with a hard coded post ID 9and it works). But I want to be able to capture the ID without having it hard coded.

    Thread Starter golddave

    (@golddave)

    That’s great. Any help breaking it down would be greatly appreciated. I’m working on it now but I’m learning PHP as I’m doing things so I’m not the most advanced coder on the block.

    Thread Starter golddave

    (@golddave)

    I’m trying to get the post id so that I can change the post_date. Essentially, I’m looking to implement the code you gave above but not hard code the post_id.

Viewing 15 replies - 106 through 120 (of 145 total)