Page 1 of 2

User Blog Mod Block

Posted: 17. December 2008 15:32
by Kharon
I need a user blog mod block ..
User Blog Mod


thank you
sorry my english very bad

example: last (x) user
Image

Re: User Blog Mod Block

Posted: 15. January 2009 02:11
by JeRicHoOL
Subsribed! I'm interested too.

Re: User Blog Mod Block

Posted: 2. April 2009 03:24
by FLATTOP
I would like to see this be developed as well

Re: User Blog Mod Block

Posted: 11. April 2009 23:38
by Amo
I'd love to see this as well. I'm working on my own block for now, but I'm not very experienced at this.

Re: User Blog Mod Block

Posted: 21. April 2009 08:40
by Pete
I would like this also!

maybe a bit more info then just number entrys.

like tittle of entrys........



Username - this is crazy

Username2 - Todays blog blah blah

username3 - Hello this is my blog
--------------------------------------



Ect etc :)

Re: User Blog Mod Block

Posted: 21. April 2009 17:25
by Kevin
Maybe Thursday i would have the time to create this block.

Re: User Blog Mod Block

Posted: 21. April 2009 18:11
by Amo
Kevin wrote:Maybe Thursday i would have the time to create this block.
That would be fantastic :D

Re: User Blog Mod Block

Posted: 23. April 2009 10:31
by Anotheridiot
I started a little work on this and came out succesful.. I think anyway.

My starting point was a thread on the user blog mod site How to display blog entries on a different phpBB3 page

I basically took the instructions and worked around them.

Start by opening portal.php and making the edits EXreaction suggests to make on index.php
FIND

Code: Select all

// Output page
ADD BEFORE

Code: Select all

// Output Blog Entries
    $blog_limit = 5;

    $user->add_lang(array('mods/blog/common', 'mods/blog/view'));
    include($phpbb_root_path . 'blog/functions.' . $phpEx);
    $blog_data = new blog_data();

    $recent_blog_ids = $blog_data->get_blog_data('recent', 0, array('limit' => $blog_limit));
    $blog_data->get_user_data(false, true);
    update_edit_delete();
    if ($recent_blog_ids !== false)
    {
       foreach ($recent_blog_ids as $id)
       {
          $template->assign_block_vars('recent_blogs', array_merge($blog_data->handle_user_data(blog_data::$blog[$id]['user_id']), $blog_data->handle_blog_data($id, $config['user_blog_text_limit'])));
       }
    }
Then I created a new file called blog_block.html and put in the following content.

Code: Select all

<div class="navbar">
	<div class="inner"><span class="corners-top"><span></span></span>
				
				
<!-- IF .recent_blogs -->
<div class="post bg3" style="text-align: center;">
   <span><span></span></span>
      <strong>{L_RECENT_BLOGS}</strong>
   <span><span></span></span>
</div>
<!-- BEGIN recent_blogs -->
<div class="post bg1<!-- IF recent_blogs.S_REPORTED or recent_blogs.S_UNAPPROVED --> reported<!-- ENDIF --><!-- IF recent_blogs.S_DELETED --> deleted<!-- ENDIF -->" <!-- IF recent_blogs.POST_COLOR and not recent_blogs.S_REPORTED and not recent_blogs.S_UNAPPROVED and not recent_blogs.S_DELETED -->style="background-color: {recent_blogs.POST_COLOR}"<!-- ENDIF -->>
	<div class="inner"><span class="corners-top"><span></span></span>

	<div class="postbody" style="width: 100%;">
	<!-- IF recent_blogs.S_UNAPPROVED or recent_blogs.S_REPORTED -->
		<p class="rules">
		<!-- IF recent_blogs.S_UNAPPROVED -->{UNAPPROVED_IMG} <a href="{recent_blogs.U_APPROVE}"><strong>{L_UNAPPROVED}</strong></a><!-- ENDIF -->
		<!-- IF recent_blogs.S_REPORTED -->{REPORTED_IMG} <a href="{recent_blogs.U_REPORT}"><strong>{L_REPORTED_SHORT}</strong></a><!-- ENDIF -->
		</p>
	<!-- ENDIF -->

	<dl>
		<dt>
			<strong><!-- IF recent_blogs.S_HAS_POLL --><img src="{T_THEME_PATH}/images/blog/icon_poll.gif" style="float: right;" alt="" /> <!-- ENDIF --><a href="{recent_blogs.U_VIEW}">{recent_blogs.TITLE}</a></strong> {L_POST_BY_AUTHOR} <strong>{recent_blogs.USER_FULL}</strong>  {L_POSTED_ON_DATE} {recent_blogs.DATE} <br />
				<div class="content" style="width: 95%; padding: 4px;">{recent_blogs.MESSAGE}</div>

				<!-- IF recent_blogs.S_HAS_ATTACHMENTS -->
					<dl class="attachbox">
						<dt>{L_ATTACHMENTS}</dt>
					</dl>
               <!-- ENDIF -->

				<br clear="all" />
				<div>
					<span class="num_replies">{recent_blogs.REPLIES}</span>
					{recent_blogs.VIEWS}
				</div>
		</dt>
	</dl>
	</div><span class="corners-bottom"><span></span></span>
   </div>
</div>
<!-- END recent_blogs -->
<!-- ENDIF -->
				
				<span class="corners-bottom"><span></span></span></div></div>
<br style="clear:both" />	
These were the edits for index_body.html suggested by Exreaction, combined with some code from the _sample_block_design.html included in the styles/prosilver/portal/block to get an appropriate look to the block.
Im still not happy with the block style itself, but I intend to work more on this by mucking around with different styles available in the _sample_block_design.html.

FYI - the block styling is the first 2 and last 2 lines below.

Then I uploaded this file to the /styles/STYLE NAME/template/portal/block

Finally I added the following line to /styles/STYLE_NAME/template/portal/portal_body.html where I wanted the block to appear.

Code: Select all

<!-- INCLUDE portal/block/blog_block.html -->
Refresh the templates, Clear the Cache and hey presto. All worked well.
You can see a sample of this at http://www.irishfishforum.com (I moved the portal credits to overall_footer I hope that this is OK).

Finally
EXreaction wrote:The main things you may like to change are the number of items displayed, and that can be changed by altering the $blog_limit in the code added to PORTAL.php, and how the blog entries are displayed. If you want them displayed in a different way you'll have to figure that out for yourself, but you can put the template code pretty much anywhere on the index_body you would like.
I hope this works for you, It was a bit of a learning process for me, but I am enjoying it so far.

Re: User Blog Mod Block

Posted: 23. April 2009 10:54
by Anotheridiot
Just to add to this, Im looking for a way to add Total Blogs to the statistics block.

If I get this Ill add instructions here.

-Dan

Re: User Blog Mod Block

Posted: 23. April 2009 12:17
by Kevin
Moved to "Modifications - In Development".

Thank you very much for sharing, Dan!
If it's okay for you, I'll post some suggestions / updated install instructions, to fit it better into B3P 1.0.3. Basically where to place the code and how to build up the template.

Re: User Blog Mod Block

Posted: 23. April 2009 12:29
by Anotheridiot
It wasnt intended to be a mod on its own, it was only something I hacked together really.
Im a network geek, not a programmer/web monkey really so its more by accident that I got it working :lol:

I cant take any credit for it, all the code was supplied by EXreaction on his site, it was just put into a format that would work with Board3.

If ive missed out on some of the formatting or it shoudl be done differently then work away on any changes you can think of Kevin.

Now that its in Mods in Development I feel all sparkley :P

Re: User Blog Mod Block

Posted: 23. April 2009 12:54
by Kevin
To use the advantages of new features for additional blocks (easier updating portals with additional blocks) and the template variables, i would suggest to build the code of Dan up like this:
  • open root/portal/block/additional_blocks.php
    find:

    Code: Select all

    if (!defined('IN_PORTAL'))
    {
        exit;
    } 
    add after:

    Code: Select all

    include($phpbb_root_path . 'portal/block/blog_block.'.$phpEx); 
  • Create a new File, called blog_block.php, contend:

    Code: Select all

    <?php
    
    if (!defined('IN_PHPBB'))
    {
       exit;
    }
    
    if (!defined('IN_PORTAL'))
    {
       exit;
    }
    
        // Output Blog Entries
            $blog_limit = 5;
    
            $user->add_lang(array('mods/blog/common', 'mods/blog/view'));
            include($phpbb_root_path . 'blog/functions.' . $phpEx);
            $blog_data = new blog_data();
    
            $recent_blog_ids = $blog_data->get_blog_data('recent', 0, array('limit' => $blog_limit));
            $blog_data->get_user_data(false, true);
            update_edit_delete();
            if ($recent_blog_ids !== false)
            {
               foreach ($recent_blog_ids as $id)
               {
                  $template->assign_block_vars('recent_blogs', array_merge($blog_data->handle_user_data(blog_data::$blog[$id]['user_id']), $blog_data->handle_blog_data($id, $config['user_blog_text_limit'])));
               }
            }
    
    
    ?>
    upload this file to root/portal/block/
  • Create a new File, called blog_block.html, contend:

    Code: Select all

    {$C_BLOCK_H_L}<dl><dt>{L_RECENT_BLOGS}</dt></dl>{$C_BLOCK_H_R}
    <div class="panel" style="margin-bottom: 0px">
        <div class="inner"><span class="portal-corners-top-inner"></span>
            <!-- BEGIN recent_blogs -->
            <div class="post bg1<!-- IF recent_blogs.S_REPORTED or recent_blogs.S_UNAPPROVED --> reported<!-- ENDIF --><!-- IF recent_blogs.S_DELETED --> deleted<!-- ENDIF -->" <!-- IF recent_blogs.POST_COLOR and not recent_blogs.S_REPORTED and not recent_blogs.S_UNAPPROVED and not recent_blogs.S_DELETED -->style="background-color: {recent_blogs.POST_COLOR}"<!-- ENDIF -->>
               <div class="inner"><span class="corners-top"><span></span></span>
        
               <div class="postbody" style="width: 100%;">
               <!-- IF recent_blogs.S_UNAPPROVED or recent_blogs.S_REPORTED -->
                  <p class="rules">
                  <!-- IF recent_blogs.S_UNAPPROVED -->{UNAPPROVED_IMG} <a href="{recent_blogs.U_APPROVE}"><strong>{L_UNAPPROVED}</strong></a><!-- ENDIF -->
                  <!-- IF recent_blogs.S_REPORTED -->{REPORTED_IMG} <a href="{recent_blogs.U_REPORT}"><strong>{L_REPORTED_SHORT}</strong></a><!-- ENDIF -->
                  </p>
               <!-- ENDIF -->
        
               <dl>
                  <dt>
                     <strong><!-- IF recent_blogs.S_HAS_POLL --><img src="{T_THEME_PATH}/images/blog/icon_poll.gif" style="float: right;" alt="" /> <!-- ENDIF --><a href="{recent_blogs.U_VIEW}">{recent_blogs.TITLE}</a></strong> {L_POST_BY_AUTHOR} <strong>{recent_blogs.USER_FULL}</strong>  {L_POSTED_ON_DATE} {recent_blogs.DATE} <br />
                        <div class="content" style="width: 95%; padding: 4px;">{recent_blogs.MESSAGE}</div>
        
                        <!-- IF recent_blogs.S_HAS_ATTACHMENTS -->
                           <dl class="attachbox">
                              <dt>{L_ATTACHMENTS}</dt>
                           </dl>
                           <!-- ENDIF -->
        
                        <br clear="all" />
                        <div>
                           <span class="num_replies">{recent_blogs.REPLIES}</span>
                           {recent_blogs.VIEWS}
                        </div>
                  </dt>
               </dl>
               </div><span class="corners-bottom"><span></span></span>
               </div>
            </div>
            <!-- END recent_blogs -->
        <span class="portal-corners-bottom-inner"></span></div>
    </div>
    {$C_BLOCK_F_L}{$C_BLOCK_F_R} 
    upload this file to root/styles/prosilver/portal/block/
  • open /styles/prosilver/template/portal/block/additional_blocks_center.html
    find:

    Code: Select all

    <!-- additional_blocks //-->        
    add after:

    Code: Select all

        <!-- INCLUDE portal/block/blog_block.html --> 

Not tested, but that should be it. Dont forget to purge the cache afterwards. ;)

Re: User Blog Mod Block

Posted: 23. April 2009 12:57
by Anotheridiot
Thanks for above Kevin

Ill check this on my test site today and post when its done.

-Dan

Re: User Blog Mod Block

Posted: 23. April 2009 13:22
by Anotheridiot
Kevin
Just up and tested. It works sweet. Great Job

The results of your work above can be seen at http://anotheridiot.net

I think I'll muck around with it a little more, just to change the style on it. I think that the 5 most recent blogs take up too much real estate on the screen/portal.
Just to sort of tighten it up a bit, maybe make the font size a bit smaller remove some of the gaps

Also see what I can do to put a <hr> between each blog entry as well.

Re: User Blog Mod Block

Posted: 23. April 2009 13:44
by Kevin
Anotheridiot wrote:Just up and tested. It works sweet. Great Job
Fine! :)