Jump to content

Search the Community

Showing results for tags 'latest posts'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • The Initiative Services and Features
  • Forum Building and Management
  • Writing Materials
  • Being a Member
  • Software
    • IPS Character Manager
  • Coding
  • Graphics

Categories

  • Roleplay Search
  • Writing Partner Search
  • Character Home Search

Categories

  • General Update
  • Announcement
  • Articles
  • Feedback
  • Tomfoolery

Categories

  • Application Templates
  • Plotters
  • Post Templates
  • Staff Templates
  • Thread Trackers
  • Other
  • Pending Challenge Entries
  • Past Challenge Entries

Categories

  • Active Challenges
  • Archived Challenges

Categories

  • Communications
  • Contributions
  • Operations

Categories

  • Jcink Themes
  • ProBoards/FreeForums Themes
  • MyBB Themes
  • IPS Themes
  • SMF Themes
  • phpBB Themes
  • Other Themes
  • Modifications
  • Make My Life Make Sense's Files
  • Dragonriders of Pern Boards's Files
  • PHPBB Staff people's Files
  • Xenforo Staff People's Files
  • Cyberpunk and Transhumanism's Files

Blogs

  • Morrigan's Madness
  • Staff Blog
  • A pirate captain's log
  • Somnia News
  • Ghost's One-Shots
  • Bits & Bones.
  • Amelia's Blog
  • Mobydoll's Blog
  • a medieval world
  • Just a girl and her stuff....
  • Everything Super
  • Icewolf's Musings
  • Ask GR - advice for RPers
  • Loose Ends
  • Tales From The Shoebox
  • Thoughts on Roleplay
  • Salt Box
  • The Salt Mine
  • Little bit of Gothic
  • The Totally Epic and True Tales of Kit the Human
  • Obvious Blog Is Obvious
  • Fountain of Thoughts
  • Please Turn The Device Off and Back On
  • gbwhatsapp apk
  • The Veritas
  • That Necromancer Life
  • Back to the narrative jungle
  • Make My Life Make Sense's Blog
  • Dragonriders of Pern Boards's Blog
  • Cryptozoology's Blog
  • Cyberpunk and Transhumanism's Blog

Calendars

  • Community Calendar
  • Character Birthdays
  • Book Club's Events
  • Make My Life Make Sense's Events
  • Dragonriders of Pern Boards's Events
  • NaNoWriMo's Virtual Write Ins
  • Cryptozoology's Events
  • Xenforo Staff People's Events
  • Cyberpunk and Transhumanism's Events

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Discord


Twitter


Skype


NaNo House


Game of Thrones House


Bending Nation

Found 1 result

  1. *** Notice: This topic has a section for users wishing to use the PHP In Templates / Complex Templates plugin or a section for users who are okay with editing their core files. I would personally suggest using the plugin that allows PHP in templates as that way you do not have to touch core files however it is up to you! PHP In Templates / Complex Templates also has MANY other useful features especially when in regards to adding custom scripts to your site without having to add them to core files. Recent Posts w/o Plugin Tutorial Created By: isoldehn Tutorial Permissions: Please do not re-post this tutorial else where, instead link someone to this thread. Tutorial Needs: Overall, the ability to copy and paste. - Knowledge Of MyBB Templates - FTP Access & Knowledge On Editing Core Files OR Ability To Upload Plugin Using PHP In Templates / Complex Templates Plugin or Altering Core Files USING PHP In Templates / Complex Templates Plugin You will need to first install the plugin and activate it. I know that this plugin needs to be extracted and if you do not have the time or resources to do such I have attached a file already extracted for you. Once the plugin is installed and activated you will need to figure out where you wish for this to show, for my example I will be doing this on the index page in a side bar. Open Templates & Style --> Templates --> your current set --> Index Page Templates --> index. Lets start with the simple additions and modifying the index to have a sidebar and include the $lattestthreads box. FIND: {$forums} REPLACE WITH: <div style="width: 70%; padding-right: 5px; box-sizing: border-box; float: left; display: inline-block;"> {$forums} </div> <div style="width: 30%; padding-left: 5px; box-sizing: border-box; float: right; display: inline-block;"> {$latestthreads} </div> Now lets include our PHP code right above {$latestthreads}! <?php $latestthreads = ''; // Latest forum discussions if($mybb->settings['portal_showdiscussions'] != 0 && $mybb->settings['portal_showdiscussionsnum'] && $mybb->settings['portal_excludediscussion'] != -1) { $altbg = alt_trow(); $threadlist = ''; $excludeforums = ''; if(!empty($mybb->settings['portal_excludediscussion'])) { $excludeforums = "AND t.fid NOT IN ({$mybb->settings['portal_excludediscussion']})"; } $query = $db->query(" SELECT t.tid, t.fid, t.uid, t.lastpost, t.lastposteruid, t.lastposter, t.subject, t.replies, t.views, t.prefix, u.username, u.usergroup, u.displaygroup FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid) WHERE 1=1 {$excludeforums}{$tunviewwhere} AND t.visible='1' AND t.closed NOT LIKE 'moved|%' ORDER BY t.lastpost DESC LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum'] ); while($thread = $db->fetch_array($query)) { $forumpermissions[$thread['fid']] = forum_permissions($thread['fid']); // Make sure we can view this thread if(isset($forumpermissions[$thread['fid']]['canonlyviewownthreads']) && $forumpermissions[$thread['fid']]['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid']) { continue; } $lastpostdate = my_date('relative', $thread['lastpost']); if(!$thread['lastposteruid'] && !$thread['lastposter']) { $lastposter = htmlspecialchars_uni($lang->guest); } else { $lastposter = htmlspecialchars_uni($thread['lastposter']); } $thread['replies'] = my_number_format($thread['replies']); $thread['views'] = my_number_format($thread['views']); // Don't link to guest's profiles (they have no profile). if($thread['lastposteruid'] == 0) { $lastposterlink = $lastposter; } else { $lastposterlink = build_profile_link(format_name($thread['lastposter'], $thread['usergroup'], $thread['displaygroup']), $thread['lastposteruid']); } $thread['subject'] = $thread['fullsubject'] = $parser->parse_badwords($thread['subject']); if(my_strlen($thread['subject']) > 25) { $thread['subject'] = my_substr($thread['subject'], 0, 25) . "..."; } $prefix = build_prefixes($thread['prefix']); $prefix = $prefix['displaystyle']; $thread['subject'] = $prefix . " " . htmlspecialchars_uni($thread['subject']); $thread['fullsubject'] = $prefix . " " . htmlspecialchars_uni($thread['fullsubject']); $thread['threadlink'] = get_thread_link($thread['tid']); $thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost"); $thread['forumlink'] = get_forum_link($thread['fid']); $thread['forumname'] = $forum_cache[$thread['fid']]['name']; eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread")."\";"); $altbg = alt_trow(); } if($threadlist) { // Show the table only if there are threads eval("\$latestthreads = \"".$templates->get("portal_latestthreads")."\";"); } } ?> To further stylize your $latestthreads template navigate to Portal Templates --> portal_latestthreads & portal_latestthreads_thread. You are finished! ALTERING Core Files You will need to navigate to you File Manager area (either through cPanel or an FTP client of some sorts). I will be using the index page for this tutorial so you should open index.php IN A CODE EDITOR SOFTWARE, other editors like Notepad may cause issues. Find $plugins->run_hooks('index_start'); this is where we will begin adding our script! Right below the line I had you find above add the following: $latestthreads = ''; // Latest forum discussions if($mybb->settings['portal_showdiscussions'] != 0 && $mybb->settings['portal_showdiscussionsnum'] && $mybb->settings['portal_excludediscussion'] != -1) { $altbg = alt_trow(); $threadlist = ''; $excludeforums = ''; if(!empty($mybb->settings['portal_excludediscussion'])) { $excludeforums = "AND t.fid NOT IN ({$mybb->settings['portal_excludediscussion']})"; } $query = $db->query(" SELECT t.tid, t.fid, t.uid, t.lastpost, t.lastposteruid, t.lastposter, t.subject, t.replies, t.views, t.prefix, u.username, u.usergroup, u.displaygroup FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid) WHERE 1=1 {$excludeforums}{$tunviewwhere} AND t.visible='1' AND t.closed NOT LIKE 'moved|%' ORDER BY t.lastpost DESC LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum'] ); while($thread = $db->fetch_array($query)) { $forumpermissions[$thread['fid']] = forum_permissions($thread['fid']); // Make sure we can view this thread if(isset($forumpermissions[$thread['fid']]['canonlyviewownthreads']) && $forumpermissions[$thread['fid']]['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid']) { continue; } $lastpostdate = my_date('relative', $thread['lastpost']); if(!$thread['lastposteruid'] && !$thread['lastposter']) { $lastposter = htmlspecialchars_uni($lang->guest); } else { $lastposter = htmlspecialchars_uni($thread['lastposter']); } $thread['replies'] = my_number_format($thread['replies']); $thread['views'] = my_number_format($thread['views']); // Don't link to guest's profiles (they have no profile). if($thread['lastposteruid'] == 0) { $lastposterlink = $lastposter; } else { $lastposterlink = build_profile_link(format_name($thread['lastposter'], $thread['usergroup'], $thread['displaygroup']), $thread['lastposteruid']); } $thread['subject'] = $thread['fullsubject'] = $parser->parse_badwords($thread['subject']); if(my_strlen($thread['subject']) > 25) { $thread['subject'] = my_substr($thread['subject'], 0, 25) . "..."; } $prefix = build_prefixes($thread['prefix']); $prefix = $prefix['displaystyle']; $thread['subject'] = $prefix . " " . htmlspecialchars_uni($thread['subject']); $thread['fullsubject'] = $prefix . " " . htmlspecialchars_uni($thread['fullsubject']); $thread['threadlink'] = get_thread_link($thread['tid']); $thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost"); $thread['forumlink'] = get_forum_link($thread['fid']); $thread['forumname'] = $forum_cache[$thread['fid']]['name']; eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread")."\";"); $altbg = alt_trow(); } if($threadlist) { // Show the table only if there are threads eval("\$latestthreads = \"".$templates->get("portal_latestthreads")."\";"); } } Open Templates & Style --> Templates --> your current set --> Index Page Templates --> index. Lets start with the simple additions and modifying the index to have a sidebar and include the $lattestthreads box. FIND: {$forums} REPLACE WITH: <div style="width: 70%; padding-right: 5px; box-sizing: border-box; float: left; display: inline-block;"> {$forums} </div> <div style="width: 30%; padding-left: 5px; box-sizing: border-box; float: right; display: inline-block;"> {$latestthreads} </div> To further stylize your $latestthreads template navigate to Portal Templates --> portal_latestthreads & portal_latestthreads_thread. You are finished! phptpl.php
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Guidelines and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.