Results 1 to 2 of 2
-
27th Jan 2012, 04:57 PM #1OPMember
First post image in the MyBB portal?
Hello friends,
Maybe someone can help me...
I want to show in myBB portal, only the first image in my post, but I don't know how to make that possible.
I installed this plugin to cut off characters:
http://mods.mybb.com/view/portal-announcement-cut-off
But doesn't work like I want, because a URL can have different numbers of characters...
Unless someone could change the code to appear only the first image inside the [ img ] [ /img] tags.
Is that possible?
PHP Code:<?php
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("portal_announcement", "portalannc");
function portalannc_info()
{
return array(
"name" => "Portal Announcement Cut Off.",
"description" => "It sets a minimum of characters for portal announcements.",
"website" => "http://www.mybb.com/",
"version" => "1.0",
"author" => "bubulang",
"authorsite" => "http://community.mybb.com/user-29135.html",
"compatibility" => "16*",
'guid' => 'a18f4b6eed189c9ffd4e4708708c15dc'
);
}
function portalannc_activate()
{
global $db;
$query = $db->simple_select("settinggroups", "gid", "name='portal'");
$gid = $db->fetch_field($query, "gid");
$setting = array(
'name' => 'patcutoff',
'title' => 'Portal Announcement Cut Off',
'description' => 'Set a minimum of characters for portal announcements?',
'optionscode' => 'yesno',
'value' => 'yes',
'disporder' => '20',
'gid' => intval($gid)
);
$db->insert_query('settings',$setting);
$characters = array(
'name' => 'characters',
'title' => 'Characters',
'description' => 'Number of characters before the announcement is cut off',
'optionscode' => 'text',
'value' => '',
'disporder' => '21',
'gid' => intval($gid)
);
$db->insert_query('settings',$characters);
$cutoffmessage = array(
'name' => 'cutoffmessage',
'title' => 'Announcement Cut Off Message',
'description' => 'Message to be displayed when announcemet is cut off',
'optionscode' => 'text',
'value' => '..... More',
'disporder' => '22',
'gid' => intval($gid)
);
$db->insert_query('settings',$cutoffmessage);
rebuild_settings();
}
function portalannc_deactivate()
{
global $db;
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='patcutoff'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='characters'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='cutoffmessage'");
rebuild_settings();
}
function portalannc()
{
global $mybb, $announcement;
if($mybb->settings['patcutoff'] == 1 AND $mybb->settings['characters'] < my_strlen($announcement['message'])){
$announcement['message'] = my_substr($announcement['message'], 0, $mybb->settings['characters']);
$announcement['message'] .= "[url=".$mybb->settings['bburl']."/".$announcement['threadlink']."]".$mybb->settings['cutoffmessage']."[/url]";
}
}
?>
Thank you!Divvy Reviewed by Divvy on . First post image in the MyBB portal? Hello friends, Maybe someone can help me... I want to show in myBB portal, only the first image in my post, but I don't know how to make that possible. I installed this plugin to cut off characters: http://mods.mybb.com/view/portal-announcement-cut-off But doesn't work like I want, because a URL can have different numbers of characters... Unless someone could change the code to appear only the first image inside the tags. Rating: 5
-
27th Jan 2012, 06:15 PM #2OPMember
Solved! Thank you anyway
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Tutorial - How to post an image
By DeLeTeD in forum Tutorials and GuidesReplies: 28Last Post: 26th May 2012, 08:21 AM -
How can I block file & image host on my mybb forum??
By DJboutit in forum Webmaster DiscussionReplies: 2Last Post: 17th May 2012, 08:05 PM -
Image limit per post should be increased
By Z_UpLoAdEr in forum Feedback and SuggestionsReplies: 9Last Post: 20th Nov 2011, 07:21 AM -
What is your favourite drink (post Image only)
By Bright in forum General DiscussionReplies: 50Last Post: 22nd Jan 2011, 06:28 AM -
Wordpress Post Image Help
By _brazzO in forum Webmaster DiscussionReplies: 5Last Post: 8th Oct 2010, 11:47 AM
themaCreator - create posts from...
Version 3.24 released. Open older version (or...