PDA

Orijinalini görmek için tıklayınız : İçeriğin bir kısmını sadece kayıtlı kullanıcı görsün



Şerafettin
06-02-2012, 22:34
Merhaba arkadaşlar benim şöyle bir sorunum var?
Sitemde yayınladığım içeriğin içinde bir bölümünü sadece kayıtlı kullanıcıların görmesini istiyorum.
Yazar yetkisi verdiğim yada daha üst yetkili kişiler içeriğe girdiğinde benim belirlediğim alanı göremeyecekler sadece normal kayıtlı kullanıcılar görecek o alanı.
Access Content Plugin - Joomla! Extensions Directory (http://extensions.joomla.org/extensions/access-a-security/site-access/content-restriction/6603)
bu eklentiyi kurdum siteme ve aşağıdaki kodu kullandığımda

* {ojaccess guest}shows only to guest users{/ojaccess}
* {ojaccess !guest}shows to all users who are not a guest{/ojaccess}
* {ojaccess registered}shows to all users who are registered{/ojaccess}
* {ojaccess guest,!editor}shows to all guests and members who are NOT editors{/ojaccess}
* {ojaccess editor,special}shows to editors, administrators, and superadministrators{/ojaccess}



{ojaccess registered}shows to all users who are registered{/ojaccess}
yazar yetkisi verdiğim kullanıcılar da görüyor içerikte kayıtlı kullanıcıların görmesini istediğim yeri.
Bu eklentiyi de kurdum.
Hider - Joomla! Extensions Directory (http://extensions.joomla.org/extensions/access-a-security/content-restriction/6004)
bunda ise kayıtlı kullanıcıların göreceği kod yok direk yazarlardan başlamış

* {author} Authors only {/author}
* {editor} Editors only {/editor}
* {publisher} Publishers only {/publisher}
* {manager} Managers only {/manager}
* {admin} Administrators only {/admin}
* {super} Super Administrators only {/super}

Bu Hider eklentisine sadece kayıtlı kullanıcılarında görebileceği şekilde yapmak mümkün mü?

Ümit
06-02-2012, 22:53
Hider için aşağıdaki seçenekler var. Reg giriş yapan, Pub giriş yapmayan. Denediniz mi bunları?
HIDER Overview | Dioscouri Design (http://dioscouri.com/index.php?option=com_content&view=article&id=1&Itemid=5)

{reg} This displays only to logged-in users {/reg}
{pub} This displays only when the user is NOT logged-in {/pub}

Şerafettin
06-02-2012, 22:57
{reg} This displays only to logged-in users {/reg} bunu kullandığım zaman siteye giriş yapan her kes görüyor bu defa

Şerafettin
06-02-2012, 23:41
Hider - Joomla! Extensions Directory eklentinin kodu böyle ; diyerk yazarlardan başlamış bu ya
bunda ekelme yaparak kayıtlı kullanıcıların göreceği gibi yapabilirmiyiz.

{registered}bunun gibi{/registered}


<?php
/**
* Author: Dioscouri Design - www.dioscouri.com
* @package Hider
* @copyright Copyright (C) 2007 Dioscouri Design. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/

/** ensure this file is being included by a parent file */
defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.' );

// Import library dependencies
jimport( 'joomla.plugin.plugin' );

/**
* Hider Content Plugin
*
* @package Hider
* @subpackage Content
* @since 1.5
*/
class plgContentHider extends JPlugin
{

/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param object $params The object that holds the plugin parameters
* @since 1.5
*/
function plgContentHider( &$subject, $params )
{
parent::__construct( $subject, $params );
}

/**
* Gets a parameter value
*
* @access public
* @return mixed Parameter value
* @since 1.5
*/
function _getParameter( $name, $default='' ) {
$return = "";
$return = $this->params->get( $name, $default );

return $return;
}

/**
* Gets a parameter value
*
* @access public
* @return mixed Parameter value
* @since 1.5
*/
function _reg( &$matches ) {

$user = JFactory::getUser();
$return = '';

if ($user->id) { $return = $matches[1]; }

return $return;
}

/**
* Gets a parameter value
*
* @access public
* @return mixed Parameter value
* @since 1.5
*/
function _pub( &$matches ) {

$user = JFactory::getUser();
$return = $matches[1];

if ($user->id) { $return = ''; }

return $return;
}

/**
* Gets a parameter value
*
* @access public
* @return mixed Parameter value
* @since 1.5
*/
function _author( &$matches ) {

$user = JFactory::getUser();
$usertype = $user->get('usertype');
$usergid = $user->get('gid');

$return = $matches[1];

if ($usergid != '19')
{
$return = '';
}

return $return;
}

/**
* Gets a parameter value
*
* @access public
* @return mixed Parameter value
* @since 1.5
*/
function _editor( &$matches ) {

$user = JFactory::getUser();
$usertype = $user->get('usertype');
$usergid = $user->get('gid');

$return = $matches[1];

if ($usergid != '20')
{
$return = '';
}


return $return;
}

/**
* Gets a parameter value
*
* @access public
* @return mixed Parameter value
* @since 1.5
*/
function _publisher( &$matches ) {

$user = JFactory::getUser();
$usertype = $user->get('usertype');
$usergid = $user->get('gid');

$return = $matches[1];

if ($usergid != '21')
{
$return = '';
}

return $return;
}

/**
* Gets a parameter value
*
* @access public
* @return mixed Parameter value
* @since 1.5
*/
function _manager( &$matches ) {

$user = JFactory::getUser();
$usertype = $user->get('usertype');
$usergid = $user->get('gid');

$return = $matches[1];

if ($usergid != '23')
{
$return = '';
}

return $return;
}

/**
* Gets a parameter value
*
* @access public
* @return mixed Parameter value
* @since 1.5
*/
function _admin( &$matches ) {

$user = JFactory::getUser();
$usertype = $user->get('usertype');
$usergid = $user->get('gid');

$return = $matches[1];


if ($usergid != '24')
{
$return = '';
}

return $return;
}

/**
* Gets a parameter value
*
* @access public
* @return mixed Parameter value
* @since 1.5
*/
function _super( &$matches ) {

$user = JFactory::getUser();
$usertype = $user->get('usertype');
$usergid = $user->get('gid');

$return = $matches[1];

if ($usergid != '25')
{
$return = '';
}

return $return;
}


/**
* Example prepare content method
*
* Method is called by the view
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
*/
function onPrepareContent( &$article, &$params, $limitstart ) {
$success = true;

// define the regular expression
$regex1 = "#{reg}(.*?){/reg}#s";
$regex2 = "#{pub}(.*?){/pub}#s";

$regex3 = "#{author}(.*?){/author}#s";
$regex4 = "#{editor}(.*?){/editor}#s";
$regex5 = "#{publisher}(.*?){/publisher}#s";
$regex6 = "#{manager}(.*?){/manager}#s";
$regex7 = "#{admin}(.*?){/admin}#s";
$regex8 = "#{super}(.*?){/super}#s";

$regex9 = "#\{19}(.*?){/19}#s";
$regex10 = "#\{20}(.*?){/20}#s";
$regex11 = "#\{21}(.*?){/21}#s";
$regex12 = "#\{23}(.*?){/23}#s";
$regex13 = "#\{24}(.*?){/24}#s";
$regex14 = "#\{25}(.*?){/25}#s";

// perform the replacement for _reg
$article->text = preg_replace_callback( $regex1, array('plgContentHider', '_reg'), $article->text );
// perform the replacement for _pub
$article->text = preg_replace_callback( $regex2, array('plgContentHider', '_pub'), $article->text );

// perform the replacement for groups by name
$article->text = preg_replace_callback( $regex3, array('plgContentHider', '_author'), $article->text );
$article->text = preg_replace_callback( $regex4, array('plgContentHider', '_editor'), $article->text );
$article->text = preg_replace_callback( $regex5, array('plgContentHider', '_publisher'), $article->text );
$article->text = preg_replace_callback( $regex6, array('plgContentHider', '_manager'), $article->text );
$article->text = preg_replace_callback( $regex7, array('plgContentHider', '_admin'), $article->text );
$article->text = preg_replace_callback( $regex8, array('plgContentHider', '_super'), $article->text );

// perform the replacement for groups by gid
$article->text = preg_replace_callback( $regex9, array('plgContentHider', '_author'), $article->text );
$article->text = preg_replace_callback( $regex10, array('plgContentHider', '_editor'), $article->text );
$article->text = preg_replace_callback( $regex11, array('plgContentHider', '_publisher'), $article->text );
$article->text = preg_replace_callback( $regex12, array('plgContentHider', '_manager'), $article->text );
$article->text = preg_replace_callback( $regex13, array('plgContentHider', '_admin'), $article->text );
$article->text = preg_replace_callback( $regex14, array('plgContentHider', '_super'), $article->text );

return $success;
}
}

Şerafettin
08-02-2012, 01:55
Merhaba arkadaşlar sorunu çözdüm.
eklentinin dosya içindeki kodlarla oynadım "registered" yoktu onu ekledim. sorun çözüldü. Joomlayı bu yüzden çok seviyorum açık kaynaklı kod. istedğin özellik olmasa bilen ekleye biliyorsun :) İyiki varsın JOOMLA :)
Eklentiyi aşağıda paylaştım arkadarşlar. Eklentiyi kurduktan sonra istediğiniz üye grubuna göre içerik yayınlaya bilirsiniz.


{registered} Sadece Üyelerin Görmesini İstediğiniz İçeriği Buraya Yazın {/registered}
{author} Sadece Yazarların Görmesini İstediğiniz İçeriği Buraya Yazın {/author}
{editor} Sadece Editörlerin Görmesini İstediğiniz İçeriği Buraya Yazın {/editor}
{publisher} Sadece Yayıncıların Görmesini İstediğiniz İçeriği Buraya Yazın {/publisher}
{manager} Sadece Yöneticinin Görmesini İstediğiniz İçeriği Buraya Yazın {/manager}
{admin} Sadece Adminin Görmesini İstediğiniz İçeriği Buraya Yazın{/admin}
{super} Sadece Süper Adminin Görmesini İstediğiniz İçeriği Buraya Yazın {/super}