Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)
  • I’m having the exact same issue but psedik’s solution isn’t helping… Any ideas – have google changed their permissions system or something the last few weeks?

    Yeah, same here… Would be awesome if I could get it working!

    Thread Starter robertkay

    (@robertkay)

    Interesting… It created the event just fine and even inputted the correct location_id (2) from the string I originally sent it (didn’t need it converted to int).

    But EM_location object is totally blank…

    OK, I think it’s a problem my end, that location_id is duff. Sorry to waste your time and thank you for your help.

    Thread Starter robertkay

    (@robertkay)

    Thanks for your response. You’re right, it was a string not an int – of the number 2. However I used intval to make it an int (and also tried an integer value) and it still generates exactly the same result.

    If you have any other ideas please shoot. Otherwise I’ll make a separate test without all the db import stuff and start trying to track it down. I’ll share the results here if I get anywhere.

    Thread Starter robertkay

    (@robertkay)

    OK, here it is. It’s an importer from another db – only a one off so not the tidiest… DB/url details have been removed. I’m looking at it now and wondering if it’s because of how I’ve included wordpress with wp-blog-header.php. Thankyou for your time.

    ————

    require_once(‘../wp-blog-header.php’);

    define(“MDB_HOST”, “localhost”);

    define(“MDB_NAME”, “”);
    define(“MDB_USER”, “”);
    define(“MDB_PASS”, “”);

    $cmskit_DB=”;
    $cmskit_BasePath=”;

    function cmskit_initDB()
    {
    global $cmskit_DB;
    $cmskit_DB=mysql_connect(‘localhost’,MDB_USER,MDB_PASS);
    cmskit_query(“USE “.MDB_NAME.”;”);
    }

    function cmskit_query($sql)
    {
    global $cmskit_DB;
    // echo ‘
    1 ‘.$sql.’
    ‘;
    $q = mysql_query($sql,$cmskit_DB) or die(‘Error: ‘.mysql_error().’ when executing ‘.$sql.’ today.’);
    return $q;
    }

    function migrate_events()
    {
    global $cmskit_DB, $cmskit_BasePath;
    $url = $cmskit_BasePath.’submit-event’;

    global $cmskit_DB;
    $sql=’SELECT event_id FROM event’;
    $events=cmskit_query($sql);

    $row = mysql_fetch_assoc($events);

    $data = getanevent($row[‘event_id’]);
    print_r($data);

    }

    function decode_sanitise($string) {
    $string = html_entity_decode($string, ENT_QUOTES, ‘UTF-8’);
    $string = htmlspecialchars_decode($string, ENT_QUOTES);
    $string = strip_tags($string);
    $string = convert_smart_quotes($string);
    return $string;
    }

    function convert_smart_quotes($string)
    {
    $search = array(‘”’,
    ‘“’,
    ‘’’,
    ‘ ‘);

    $replace = array(‘”‘,
    ‘”‘,
    “‘”,
    ” “
    );

    return str_replace($search, $replace, $string);
    }

    function one_to_many($table, $field, $db_row, $event_id) {
    $qry = “SELECT “.$field.”.”.$field.”_lable FROM “.$field.”, “.$table.” WHERE “.$table.”.event_id='”. $event_id .”‘ AND “.$table.”.”.$field.”_id = “.$field.”.”.$field.”_id”;
    $result = mysql_query($qry) or die(mysql_error() . ” 3″);
    $rows_count = mysql_num_rows($result);
    $result_count = 1;
    $result_concat = “”;
    while($row = mysql_fetch_array($result)) {
    if ($result_count < $rows_count) {
    $result_concat .= decode_sanitise($row[$db_row]) . “, “;
    }
    else {
    $result_concat .= decode_sanitise($row[$db_row]);
    }
    $result_count++;
    }
    return $result_concat;
    }

    function getanevent($event_id)
    {
    $con = mysql_connect(MDB_HOST, MDB_USER, MDB_PASS);
    if (!$con)
    {
    die(‘Could not connect: ‘ . mysql_error());
    }

    mysql_select_db(‘MDB_NAME’, $con);

    // Query for event info
    $qry = “SELECT event_id, event_title, venue_id, date, st_time, end_time, price_min, price_max, description, event_url, youtube_url, approved, canceled, published, deleted, created_by FROM event WHERE event_id=’$event_id’ AND approved =’1′”;
    $result = mysql_query($qry) or die(mysql_error() . ” 1″);

    while($row = mysql_fetch_array($result)){
    $event_id = $row[‘event_id’];
    $event_title = decode_sanitise($row[‘event_title’]);
    $venue_id = $row[‘venue_id’];
    $date = $row[‘date’];
    $st_time = $row[‘st_time’];
    $end_time = $row[‘end_time’];
    $price_min = $row[‘price_min’];
    $price_max = $row[‘price_max’];
    $description = decode_sanitise($row[‘description’]);
    $event_url = $row[‘event_url’];
    $youtube_url = $row[‘youtube_url’];
    $approved = $row[‘approved’];
    $canceled = $row[‘canceled’];
    $created_by = $row[‘created_by’];
    }

    //Query for event image
    $qry = “SELECT images.img_name, images.img_url, images.approved, images.tag
    FROM images, event_image
    WHERE event_image.event_id=’$event_id’
    AND event_image.img_id = images.img_id
    AND images.img_url = ‘images/usr_event/'”;
    $result = mysql_query($qry) or die(mysql_error() . ” 4″);

    while($row = mysql_fetch_array($result)){
    $img_event_name = $row[‘img_name’];
    $img_event_url = $row[‘img_url’];
    $img_event_tag = decode_sanitise($row[‘tag’]);
    $img_event_approved = $row[‘approved’];
    }

    //Query for Venue info
    $qry = “SELECT venue.venue_lable, venue.street, venue.postcode, venue.venue_url, venue.venue_lat, venue.venue_lng, venue.approved,
    region.region_lable, town.town_lable
    FROM venue

    LEFT JOIN region
    ON venue.region_id = region.region_id

    LEFT JOIN town
    ON venue.town_id = town.town_id

    LEFT JOIN area
    ON venue.area_id = area.area_id

    WHERE venue.venue_id=’$venue_id'”;
    $result = mysql_query($qry) or die(mysql_error() . ” 2″);

    while($row = mysql_fetch_array($result)){
    $venue_lable = decode_sanitise($row[‘venue_lable’]);
    $street = decode_sanitise($row[‘street’]);
    $region_lable = $row[‘region_lable’];
    $town_lable = decode_sanitise($row[‘town_lable’]);
    $postcode = $row[‘postcode’];
    $venue_url = $row[‘venue_url’];
    $venue_approved = $row[‘approved’];
    $venue_lat = $row[‘venue_lat’];
    $venue_lng = $row[‘venue_lng’];
    }

    $genre = “”;
    $artist = “”;
    $continent = “”;
    $country = “”;

    $genre = one_to_many(“event_genre”, “genre”, “genre_lable”, $event_id);
    $artist = one_to_many(“event_artist”, “artist”, “artist_lable”, $event_id);
    $continent = one_to_many(“event_continent”, “continent”, “continent_lable”, $event_id);
    $country = one_to_many(“event_country”, “country”, “country_lable”, $event_id);

    $EM_Event = new EM_Event();
    $EM_Event->event_name = ‘your event’;
    $EM_Event->event_name=$event_title;
    $EM_Event->location_latitude=$venue_lat;
    $EM_Event->location_longitude=$venue_lng;
    $EM_Event->location_id=$venue_id;
    $EM_Event->location_name=$venue_lable;
    $EM_Event->location_address=$street;
    $EM_Event->location_town=$town_lable;
    $EM_Event->location_state=$region_lable;
    $EM_Event->location_postcode=$postcode;
    $EM_Event->location_region=$region_lable;
    $EM_Event->location_country=$country;
    $EM_Event->content=$description;
    $EM_Event->image_url=$img_event_url;
    $EM_Event->event_start_date=$date;
    $EM_Event->event_end_date=nextdaycalc($date, $st_time, $end_time);
    $EM_Event->event_start_time=$st_time;
    $EM_Event->event_end_time=$end_time;
    $EM_Event->event_attributes=array(‘fburl’ => fburlcalc($event_url), ‘ticketurla’ => ”, ‘ticketurlb’ => ”, ‘ticketurlc’ => ”);
    $EM_Event->artist=$artist;
    $EM_Event->genre=$genre;
    $EM_Event->event_price_low=$price_min;
    $EM_Event->event_price_high=$price_max;
    $EM_Event->fbEventId=fbidcalc($event_url);

    print_r($EM_Event);

    $EM_Event->save();

    return $postarray;
    }

    function nextdaycalc($date, $st_time, $end_time)
    {

    }
    function fburlcalc($event_url)
    {

    }
    function fbidcalc($event_url)
    {

    }

    cmskit_initDB();
    migrate_events();

    robertkay

    (@robertkay)

    Yep same issue here across all my blogs – really annoying. I’ll just have to turn off comment notification and then check each blog regularly otherwise I get hundreds of emails!

    Same here. Does anyone actually get it to do anything here? I mean there are some mailchimp stats higher up on the page so maybe that’s it? …

    Thread Starter robertkay

    (@robertkay)

    I was using the html editor. My mistake with the tags. Many thanks!

    Thread Starter robertkay

    (@robertkay)

    OK, so now I’ve run into a related problem. When I do this [embed] thing it works great except wordpress puts a <p> tag either side of the video so I can’t style it (ie center it). There’s no class on it so I can’t get to it via stylesheet. Anyone got any suggestions? I could maybe style <object> tags in style.css but then I’d be stuck with one style for all videos which my client will probably complain about…

    Much ‘preciated,
    Rob

    Thread Starter robertkay

    (@robertkay)

    That makes sense. Interestingly, switching off the auto-embed option in the Settings->Media panel does not solve this problem. So basically, for all new posts I’m stuck with the new (admittedly more convenient) auto-embeds. I shall be curious to see how they run with lightbox popups etc. I’ve had issues with Youtube’s new iframe code and had to go back to the old one. Enough musing anyway:)

    Thread Starter robertkay

    (@robertkay)

    Aha. Thankyou. I’ll try just putting the url in rather than the full embed code.

    So… Given I have a bunch of blogs with youtube vids embeded with the old/new style full embed codes (ie iframe, object etc), what happens to these when I upgrade to the latest wordpress. Am I going to have issues editing posts?

    Many thanks for this. So simple but cause a lot of annoyance…:)

    Thread Starter robertkay

    (@robertkay)

    Thanks so much I’ll try that. What a daft thing to be stuck on!

    It works:-)

Viewing 12 replies - 1 through 12 (of 12 total)