* User

Welcome, Guest. Please login or register.
Did you miss your activation email?

09 Sep 10, 14:25:14

Login with username, password and session length

Select language:

* Recent Topics



Donate

Donate for PortaMx !
Your donation is safe and helps support the issues and causes you care most about.

* Stats

  • *Total Members: 2451
  • *Latest: teste

  • *Total Posts: 10802
  • *Total Topics: 1633
  • *Online Today: 27
  • *Most Online: 157
(27 Aug 09, 03:54:53)
  • *Users: 1
  • *Guests: 18
  • *Total: 19

Author Topic: Blog feed block  (Read 3209 times)

0 Members and 1 Guest are viewing this topic.

Offline bluedevil

  • Newbie
  • *
  • Posts: 20
  • Gender: Male
    • ChevyAvalancheClub
Re: Blog feed block
« Reply #30 on: 17 Feb 10, 22:40:18 »
Based on the code i posted above, showing blog posts from admin or global moderator only cant be done?

I dont want to show regular users blog posts in a block.

Offline feline

  • CO PortaMx corp.
  • Administrator
  • *
  • Posts: 3372
  • Gender: Female
Re: Blog feed block
« Reply #31 on: 17 Feb 10, 22:55:17 »
set the access rights for the block ...

Fel
Many are stubborn in relation to the path, a few in relation to the target.

Offline bluedevil

  • Newbie
  • *
  • Posts: 20
  • Gender: Male
    • ChevyAvalancheClub
Re: Blog feed block
« Reply #32 on: 17 Feb 10, 23:08:15 »
set the access rights for the block ...

Fel



I want everyone to see my (admin) blog posts in the front page in a block.  I dont want to publish regular users.

Offline feline

  • CO PortaMx corp.
  • Administrator
  • *
  • Posts: 3372
  • Gender: Female
Re: Blog feed block
« Reply #33 on: 18 Feb 10, 10:32:09 »
I understand correctly, that YOUR blog should be see for all, but not the articles in the other blog users?
In this case I must say, that this is not possible ...

Fel
Many are stubborn in relation to the path, a few in relation to the target.

Offline Tormod

  • Newbie
  • *
  • Posts: 21
  • Gender: Male
    • Fuglepraten.no
Re: Blog feed block
« Reply #34 on: 19 Apr 10, 15:04:13 »
Yes, try this ..
Code: [Select]
include_once('PmxBlogSSI.php');
global $context, $smcFunc, $user_info, $txt;

$maxarticles = 5; // max articles to show
$context['PmxBlog']['content_len'] = 40; // Teaser length

if(AllowedToBlog('view'))
{
$result = array();
$req = $smcFunc['db_query']('', '
SELECT c.ID, c.subject
FROM {db_prefix}pmxblog_content AS c
LEFT JOIN {db_prefix}members AS m ON (c.owner = m.id_member)
LEFT JOIN {db_prefix}pmxblog_manager AS a ON (c.owner = a.owner)
WHERE a.blogenabled > 0 AND a.bloglocked = 0 AND c.published = 1
AND (c.allow_view = 0
OR (c.allow_view = 1 AND {int:idmem} > 0)
OR (c.allow_view = 2 AND {string:s_idmem} IN (m.buddy_list))
OR (c.allow_view = 3 AND c.owner = {int:idmem})
OR (c.owner = {int:idmem}))
GROUP BY c.ID
ORDER BY c.date_created DESC
LIMIT {int:lim}',
array(
's_idmem' => (string) $user_info['id'],
'idmem' => $user_info['id'],
'lim' => $maxarticles,
)
);
if($smcFunc['db_num_rows']($req) > 0)
{
$i = 0;
while($row = $smcFunc['db_fetch_assoc']($req))
{
$result[$i] = array('id' => $row['ID'], 'subject' => $row['subject']);
$i++;
}
$smcFunc['db_free_result']($req);
}

// link requested?
if(isset($_REQUEST['blogcont']))
$artid = (int) $_REQUEST['blogcont'];
elseif(!empty($result))
$artid = $result[0]['id'];
else
{
echo '
'. $txt['PmxBlog_nothing_read'];
return;
}

// get the selected article data
$article = PmxBlogSSI_GetArticle($artid, '');
$article['body'] = Post_Teaser($article['body']); // call the teaser
PmxBlogArticles_SSI_Out($article, $result, $artid);
}

Fel

I want to have a link say Read more, where Do I put that, and what to write the code? This feed work good for my website.

Offline feline

  • CO PortaMx corp.
  • Administrator
  • *
  • Posts: 3372
  • Gender: Female
Re: Blog feed block
« Reply #35 on: 19 Apr 10, 16:51:57 »
Try this code in a php block...
Code: [Select]
include_once('PmxBlogSSI.php');
global $context, $smcFunc, $user_info, $txt, $scripturl;

$maxarticles = 5;   // max articles to show
$context['PmxBlog']['content_len'] = 40;      // Teaser length

if(AllowedToBlog('view'))
{
   $result = array();
   $req = $smcFunc['db_query']('', '
      SELECT c.ID, c.subject
      FROM {db_prefix}pmxblog_content AS c
      LEFT JOIN {db_prefix}members AS m ON (c.owner = m.id_member)
      LEFT JOIN {db_prefix}pmxblog_manager AS a ON (c.owner = a.owner)
      WHERE a.blogenabled > 0 AND a.bloglocked = 0 AND c.published = 1
         AND (c.allow_view = 0
         OR (c.allow_view = 1 AND {int:idmem} > 0)
         OR (c.allow_view = 2 AND {string:s_idmem} IN (m.buddy_list))
         OR (c.allow_view = 3 AND c.owner = {int:idmem})
         OR (c.owner = {int:idmem}))
      GROUP BY c.ID
      ORDER BY c.date_created DESC
      LIMIT {int:lim}',
      array(
         's_idmem' => (string) $user_info['id'],
         'idmem' => $user_info['id'],
         'lim' => $maxarticles,
      )
   );
   if($smcFunc['db_num_rows']($req) > 0)
   {
      $i = 0;
      while($row = $smcFunc['db_fetch_assoc']($req))
      {
         $result[$i] = array('id' => $row['ID'], 'subject' => $row['subject']);
         $i++;
      }
      $smcFunc['db_free_result']($req);
   }

   // link requested?
   if(isset($_REQUEST['blogcont']))
      $artid = (int) $_REQUEST['blogcont'];
   elseif(!empty($result))
      $artid = $result[0]['id'];
   else
   {
      echo '
      '. $txt['PmxBlog_nothing_read'];
      return;
   }

   // get the selected article data
   $article = PmxBlogSSI_GetArticle($artid, '');
   $article['body'] = Post_Teaser($article['body']);   // call the teaser

   // add a "Read more" link...
   $article['body'] .= '<div style="padding-top:10px;"><a href="'. $scripturl .'?action=pmxblog;sa=view;cont='. $artid .';uid='. $article['ownerid'] .'">'. $txt['PmxBlog_readmore'] .'</a></div>';

   PmxBlogArticles_SSI_Out($article, $result, $artid);
}

Fel
Many are stubborn in relation to the path, a few in relation to the target.