MyBB Community Forums

Full Version: MyBB Scratchboard – Post your random admin/dev stuff
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
yea, I hate that it looks so clunky - but if you have to click a button to open it then you might as well just use the full new thread....

I dunno - just because we CAN do something does not mean we should I guess. Hmm.
I'm working on a plugin to try to integrate the WDtN Short URL API into a forum. If I finish it (mainly trying to figure out how the hell to insert the link into a template), I'll ask Eric/Euan/FMB/WDtN in general if I can release it. Meantime though, it's still hidden on my main site.

Update: I've managed to get everything to work right except for the final link - it's always throwing my testing "Unable to generate short link" error at me. Sad
(2012-11-17, 02:43 AM)Leefish Wrote: [ -> ]yea, I hate that it looks so clunky - but if you have to click a button to open it then you might as well just use the full new thread....

I dunno - just because we CAN do something does not mean we should I guess. Hmm.

Looks like too much to me. I'd just keep a separate new thread page.

EDIT:

Or take out the smileys and make the height less?
Maybe also remove the text editor then, keep it simple.
I think it is the text editor that is making it look worst - it is really the smilies I am after, I would really like to have the smilies in a drop down from the code editor buttons. I just use the text shortcuts, but my users are not very good at that. I shall glare at it some more Big Grin
(2012-11-17, 03:10 AM)Seabody Wrote: [ -> ]I'm working on a plugin to try to integrate the WDtN Short URL API into a forum. If I finish it (mainly trying to figure out how the hell to insert the link into a template), I'll ask Eric/Euan/FMB/WDtN in general if I can release it. Meantime though, it's still hidden on my main site.

Update: I've managed to get everything to work right except for the final link - it's always throwing my testing "Unable to generate short link" error at me. Sad

I don't see any problem with you releasing it Smile I made one for WeDesign after I set up the shortener. Here's the basic code behind it if you're needing help:

Hook: newthread_do_newthread_end

global $db, $mybb, $url, $tid;

$curl = curl_init('http://wdtn.co/api/shortener/create');
curl_setopt_array(
    $curl,
    array(
        CURLOPT_RETURNTRANSFER  =>  1,
        CURLOPT_TIMEOUT         =>  30,
        CURLOPT_POST            =>  1,
        CURLOPT_POSTFIELDS      =>  array('url' => $mybb->settings['bburl'].'/'.$url),
    )
);
$result = curl_exec($curl);
curl_close($curl);

$result = json_decode($result);

if (!$result->error) {
    $db->update_query('threads', array('shortlink' => $db->escape_string($result->slug)), "tid = '". (int) $tid."'");
}

Then for WD I used a Laravel task file to iterate through old threads and generate a new shortlink. I don't seem to have that file anymore though. It was pretty simple to create.

Because of the use of JSON you'll have to make it clear the plugin is only for > PHP 5.2. Most people should be running versions newer than that though...
Thanks euan. Now the only problem is accessing the db - my installation and uninstallation queries don't seem to be working.
@wethregreenpeople: Indeed, interesting as an experiment even if it's not going to produce much viable as a product. I don't think someone would use MyBB for a project like this, though I guess anything is possible!

To get rid of the subject, you could probably have it submit as a hidden field with the username + the date or something.

@leefish: I think newthread on forumdisplay is a solution in search of a problem, really. :\
redesigning the usercp without redesigning it. redesign ception.

https://dl.dropbox.com/u/54081213/r/dg/ucp.png

trollolol
I'm doing a new theme incorporating quite a bit of the things found in the MyBB Humanization Project, of course with a touch of FMB.