Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 28 Ответов
  • 8775 Просмотров
*

Phenom

  • Осваиваюсь на форуме
  • 32
  • 0 / 0
Логин вместо имени
« : 25.04.2009, 18:14:30 »
Подскажите пожалуйста, как сделать чтобы в материалах отображался логин автора, а не его имя? Причем желательно, что бы логин был в виде ссылки на профиль в CB ? Очень нужно  :(

joomla 1.5.9

*

beliyadm

  • Легенда
  • 9758
  • 1664 / 66
  • Севастополь, Россия
Re: Логин вместо имени
« Ответ #1 : 25.04.2009, 19:48:25 »
в каком именно месте материала?
Все истины, которые я хочу вам изложить, — бесстыдная ложь. Сделать всё хорошо
TLG: @Beliyadm
*

Phenom

  • Осваиваюсь на форуме
  • 32
  • 0 / 0
Re: Логин вместо имени
« Ответ #2 : 25.04.2009, 21:41:16 »
В том месте где он по стандарту стоит, т.е. после названия материала, там же где и дата создания стоит.
*

beliyadm

  • Легенда
  • 9758
  • 1664 / 66
  • Севастополь, Россия
Re: Логин вместо имени
« Ответ #3 : 25.04.2009, 22:03:21 »
К примеру для режима просмотра материала (когда view=article) нужны два действия
components\com_content\models\article.php строка примерно 512
$query 'SELECT a.*, u.name AS author, u.usertype, cc.title AS category, s.title AS section,' .
заменить на
$query 'SELECT a.*, u.name AS author, u.id AS userid, u.username AS article_username, u.usertype, cc.title AS category, s.title AS section,' .

После в файле components\com_content\views\article\tmpl\default.php найти формирование вывода информации об авторе  (примерно 95-97 строки)

	
<?
php JText::printf'Written by', ($this->article->created_by_alias $this->article->created_by_alias $this->article->author) ); ?>

и заменить на

	
<?
php
	
$cblink '<a href="">'.$this->article->article_username.'</a>';
	
JText::printf'Written by', ($cblink) );
	
?>

Ну и в ссылке передавать ID автора для перенаправления на страницу профиля CB через $this->article->userid. Структуру ссылок в СВ не знаю, потому не привожу (не забываем про JRoute)

Все истины, которые я хочу вам изложить, — бесстыдная ложь. Сделать всё хорошо
TLG: @Beliyadm
*

Phenom

  • Осваиваюсь на форуме
  • 32
  • 0 / 0
Re: Логин вместо имени
« Ответ #4 : 26.04.2009, 00:32:09 »
Большущее спасибо за помощь, не знаю что бы без вас делал. Все работает если просматривать в формате материала, но в формате блога категории или раздела реализовать не получилось. Помогите с файлами "section.php" "frontpage.php" "category.php"  которые лежат в папке "components\com_content\models\" . Заранее спасибо !

*

beliyadm

  • Легенда
  • 9758
  • 1664 / 66
  • Севастополь, Россия
Re: Логин вместо имени
« Ответ #5 : 26.04.2009, 00:42:15 »
для category.php находим функцию function _buildQuery($state = 1) примерно 348 строка
$query 'SELECT cc.title AS category, a.id, a.title, a.alias, a.title_alias, a.introtext, a.fulltext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by,' .
стало
$query 'SELECT cc.title AS category, a.id, u.id AS userid, u.username AS article_username, a.title, a.alias, a.title_alias, a.introtext, a.fulltext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by,' .

Для section.php function _buildQuery($state = 1) строка 400 и frontpage.php строка 115 аналогично добавляем u.id AS userid, u.username AS article_username в первую строку запроса
Все истины, которые я хочу вам изложить, — бесстыдная ложь. Сделать всё хорошо
TLG: @Beliyadm
*

Phenom

  • Осваиваюсь на форуме
  • 32
  • 0 / 0
Re: Логин вместо имени
« Ответ #6 : 27.04.2009, 10:22:44 »
Все работает большущее тебе спасибо, beliyadm. Все работает, как часы ^-^. И так, что бы автор отображался логином вместо имени, со ссылкой на профиль CB. Нужно:


В файле: components\com_content\models\article.php найти строчку
Код: php
$query = 'SELECT a.*, u.name AS author, u.usertype, cc.title AS category, s.title AS section,' .
и заменить на
Код: php
$query = 'SELECT a.*, u.name AS author, u.id AS userid, u.username AS article_username, u.usertype, cc.title AS category, s.title AS section,' .


Затем в файле components\com_content\models\section.php строчку
Код: php
$query = 'SELECT a.id, a.title, a.title_alias, a.introtext, a.fulltext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by,' .
заменить на
Код: php
$query = 'SELECT a.id, a.title, a.title_alias, u.id AS userid, u.username AS article_username, a.introtext, a.fulltext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by,' .


В файле components\com_content\models\category.php строчку
Код: php
$query = 'SELECT cc.title AS category, a.id, a.title, a.title_alias, a.introtext, a.fulltext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by,' .
заменить на
Код: php
$query = 'SELECT cc.title AS category, a.id, u.id AS userid, u.username AS article_username, a.title, a.title_alias, a.introtext, a.fulltext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by,' .


После в файле:
components\com_content\views\article\tmpl\default.php найти строчку
Код: php
<?php JText::printf( 'Written by', ($this->article->created_by_alias ? $this->article->created_by_alias : $this->article->author) ); ?>
и в файле article\tmpl\default.php заменить на:
Код: php
<?php $cblink = '<a href="index.php?option=com_comprofiler&task=userProfile&user='.$this->article->userid.'">'.$this->article->article_username.'</a>'; JText::printf( 'Written by', ($cblink) );?>


и в файлах
components\com_content\views\cection\tmpl\blog_item.php
components\com_content\views\category\tmpl\blog_item.php найти:
Код: php
<?php JText::printf( 'Written by', ($this->item->created_by_alias ? $this->item->created_by_alias : $this->item->author) ); ?>
заменить на:
Код: php
<?php $cblink = '<a href="index.php?option=com_comprofiler&task=userProfile&user='.$this->item->userid.'">'.$this->item->article_username.'</a>'; JText::printf( 'Written by', ($cblink) );?>
*

Phenom

  • Осваиваюсь на форуме
  • 32
  • 0 / 0
Re: Логин вместо имени
« Ответ #7 : 27.04.2009, 10:27:21 »
И еще вопрос, есть ли плагин или хак какой, что бы количество просмотров отображалось, желательно примерно в том же месте где и автор материала. Пробовал mosauthorxtd 2.0 после включения выдает ошибку:
Fatal error: Call to undefined method JSite::getDBO() in \plugins\content\mosauthorxtd.php on line 20  :(
« Последнее редактирование: 27.04.2009, 10:34:48 от Phenom »
*

beliyadm

  • Легенда
  • 9758
  • 1664 / 66
  • Севастополь, Россия
Re: Логин вместо имени
« Ответ #8 : 27.04.2009, 13:18:33 »
не надо ничего дополнительно ставить, аналогично как мы только что сделали с именем и ID в выборку в нужных моделях добавляем в запрос поле HITS (посмотри структуру таблицы jos_content) - ну и в шаблон точно так же вставлять
Все истины, которые я хочу вам изложить, — бесстыдная ложь. Сделать всё хорошо
TLG: @Beliyadm
*

Phenom

  • Осваиваюсь на форуме
  • 32
  • 0 / 0
Re: Логин вместо имени
« Ответ #9 : 27.04.2009, 20:17:16 »
Еще раз большое спасибо, все работает. Просто я с MySQL и PHP совсем не знаком, а потому думал, что все крайне сложно и просто через поле hits ни чего не получится ^-^.
*

beliyadm

  • Легенда
  • 9758
  • 1664 / 66
  • Севастополь, Россия
Re: Логин вместо имени
« Ответ #10 : 27.04.2009, 20:21:38 »
не за что ))
спасибо не булькает  *DRINK*
Все истины, которые я хочу вам изложить, — бесстыдная ложь. Сделать всё хорошо
TLG: @Beliyadm
*

Protegon

  • Осваиваюсь на форуме
  • 11
  • 0 / 0
Re: Логин вместо имени
« Ответ #11 : 11.07.2009, 18:59:40 »
Все работает большущее тебе спасибо, beliyadm. Все работает, как часы ^-^. И так, что бы автор отображался логином вместо имени, со ссылкой на профиль CB. Нужно:


В файле: components\com_content\models\article.php найти строчку
Код: php
$query = 'SELECT a.*, u.name AS author, u.usertype, cc.title AS category, s.title AS section,' .
и заменить на
Код: php
$query = 'SELECT a.*, u.name AS author, u.id AS userid, u.username AS article_username, u.usertype, cc.title AS category, s.title AS section,' .


Затем в файле components\com_content\models\section.php строчку
Код: php
$query = 'SELECT a.id, a.title, a.title_alias, a.introtext, a.fulltext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by,' .
заменить на
Код: php
$query = 'SELECT a.id, a.title, a.title_alias, u.id AS userid, u.username AS article_username, a.introtext, a.fulltext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by,' .


В файле components\com_content\models\category.php строчку
Код: php
$query = 'SELECT cc.title AS category, a.id, a.title, a.title_alias, a.introtext, a.fulltext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by,' .
заменить на
Код: php
$query = 'SELECT cc.title AS category, a.id, u.id AS userid, u.username AS article_username, a.title, a.title_alias, a.introtext, a.fulltext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by,' .


После в файле:
components\com_content\views\article\tmpl\default.php найти строчку
Код: php
<?php JText::printf( 'Written by', ($this->article->created_by_alias ? $this->article->created_by_alias : $this->article->author) ); ?>
и в файле article\tmpl\default.php заменить на:
Код: php
<?php $cblink = '<a href="index.php?option=com_comprofiler&task=userProfile&user='.$this->article->userid.'">'.$this->article->article_username.'</a>'; JText::printf( 'Written by', ($cblink) );?>


и в файлах
components\com_content\views\cection\tmpl\blog_item.php
components\com_content\views\category\tmpl\blog_item.php найти:
Код: php
<?php JText::printf( 'Written by', ($this->item->created_by_alias ? $this->item->created_by_alias : $this->item->author) ); ?>
заменить на:
Код: php
<?php $cblink = '<a href="index.php?option=com_comprofiler&task=userProfile&user='.$this->item->userid.'">'.$this->item->article_username.'</a>'; JText::printf( 'Written by', ($cblink) );?>

Thanks, this is excelent. The only place where i can find this. ok, excuse me for speak english, but i don't speak rush.

well, can do you help me? i try this but the avatar, but not good result. How do you put in the avatar in each article?

Thanks.


*

beliyadm

  • Легенда
  • 9758
  • 1664 / 66
  • Севастополь, Россия
Re: Логин вместо имени
« Ответ #12 : 11.07.2009, 19:06:49 »
Thanks, this is excelent. The only place where i can find this. ok, excuse me for speak english, but i don't speak rush.
well, can do you help me? i try this but the avatar, but not good result. How do you put in the avatar in each article?
Always happy to help
Refine - where (of a component - CommutyBuilder?) You need to get the user's avatar and where the standard com_content show?
I understand that the avatar from CB need to show in com_content (the author avatar of this material)?
Different variations of the decision will be different (for the regime and the regime BLOG view the full text of articles for example)

And sorry for my eng, very bad, I know
Все истины, которые я хочу вам изложить, — бесстыдная ложь. Сделать всё хорошо
TLG: @Beliyadm
*

Protegon

  • Осваиваюсь на форуме
  • 11
  • 0 / 0
Re: Логин вместо имени
« Ответ #13 : 11.07.2009, 23:48:37 »
Yes, i need user the community builder avatar, in each Article Content, no blog, no frontpage, just in one individual article.

I think using ID of com_profiler and the path of avatar's image, but i dont know use this php code.

*

beliyadm

  • Легенда
  • 9758
  • 1664 / 66
  • Севастополь, Россия
Re: Логин вместо имени
« Ответ #14 : 12.07.2009, 00:17:08 »
if you know SQL - just simple, else - I'll try details comment for the code
components\com_content\models\article.php - in this file found sql query
Код: php
$query = 'SELECT a.*, u.name AS author, u.usertype, cc.title AS category, s.title AS section,' .
and JOIN the table com_profiler (sorry - not sure of the title of the table)
like
Код: sql
LEFT JOIN #__tableCB_name as cb ON cb.field = a.created_by
and join this field (img avatar link) in the SELECT (with alias cbAvatar)
next in the file components\com_content\views\article\tmpl\default.php join this field
Код: php
$this->article->cbAvatar

Sorry, I dont know the structure table Community Builder, but if you really need it - I'm install CB and show all code to your requirements
« Последнее редактирование: 12.07.2009, 00:27:20 от beliyadm »
Все истины, которые я хочу вам изложить, — бесстыдная ложь. Сделать всё хорошо
TLG: @Beliyadm
*

Protegon

  • Осваиваюсь на форуме
  • 11
  • 0 / 0
Re: Логин вместо имени
« Ответ #15 : 18.07.2009, 11:06:00 »
mmm please beliyadm, i need more code because i don't know very much, i understand that code but i can't do it

thanks
*

Protegon

  • Осваиваюсь на форуме
  • 11
  • 0 / 0
Re: Логин вместо имени
« Ответ #16 : 18.07.2009, 11:41:35 »
ok, i try your code and do that with this code in
components\com_content\views\article\tmpl\default.php

<?php echo '<img style="width:10%;height:10%;" src="/images/comprofiler/'.$this->article->cbAvatar.'" />' ?>

and i have a wonderfull result. I make the final modification and i tell you everything and show the result.

THANKS MEN
*

beliyadm

  • Легенда
  • 9758
  • 1664 / 66
  • Севастополь, Россия
Re: Логин вместо имени
« Ответ #17 : 18.07.2009, 11:46:36 »
Everything works as expected? but then I download CB to see the structure of tables and tell you the entire code. I am glad that could help :)
Can you give link to your site - interesting to see hack's result  ;)
Все истины, которые я хочу вам изложить, — бесстыдная ложь. Сделать всё хорошо
TLG: @Beliyadm
*

Protegon

  • Осваиваюсь на форуме
  • 11
  • 0 / 0
Re: Логин вместо имени
« Ответ #18 : 18.07.2009, 14:01:45 »
Everything works as expected? but then I download CB to see the structure of tables and tell you the entire code. I am glad that could help :)
Can you give link to your site - interesting to see hack's result  ;)

Men, you save my day. I speak spanish not english, just a bit english. check this code

Код: php
		<table><tr><td><?php

if (($this->article->cbAvatar != ""))

echo '<img style="width:67px;height:111px;" src="/images/comprofiler/'.$this->article->cbAvatar.'" />' ?>




</td><td valign="top"><span class="createby"> <?php $cblink = '<a href="index.php?option=com_comprofiler&task=userProfile&user='.$this->article->userid.'">'.$this->article->article_username.'</a>'; JText::printf(($cblink) );?>
</span>
<?php endif; ?>

<?php if ($this->params->get('show_create_date')) : ?>
<span class="createdate">
<?php echo JHTML::_('date', $this->article->created, JText::_('DATE_FORMAT_LC2')) ?>
</span><br />

<div style="color:white;line-height:7px;"> <?php echo

'<br><div style="margin-bottom:3px;">- <strong>Asunto: </strong>'.$this->article->title.'</div></br>'?>

<?php if (($this->article->cbEscena != "")) echo' <br><strong>- Escena Favorita:</strong> '.$this->article->cbEscena.'<br/>'?>
        <?php if (($this->article->cbEscena == "")) echo' <br><strong>- Escena Favorita:</strong> El usuario no ha especificado este dato<br/>'?>

<?php if (($this->article->cbShichibukai != "")) echo '<br><strong>- Shichibukai Favorito:</strong> '.$this->article->cbShichibukai.'</br>' ?>
<?php if (($this->article->cbShichibukai == "")) echo '<br><strong>- Shichibukai Favorito:</strong> El usuario no ha especificado este dato</br>' ?>



</div>
<?php endif; ?></td></tr></table>

   
your code did this!!!

   
NOT ONLY AVATAR, ALSO PROFILE FIELDS. This is my website http://protegon.zobyhost.com/

One article for example: http://protegon.zobyhost.com/actualizando-nuevamente--este-blog-2201.html

I add profile fields with the code. but i don't know php just copy and paste but I analyze this little hack

Thanks beliyadm это здорово!
*

beliyadm

  • Легенда
  • 9758
  • 1664 / 66
  • Севастополь, Россия
Re: Логин вместо имени
« Ответ #19 : 18.07.2009, 14:10:02 »
parece excelente!
Buena suerte en el futuro se esfuerza )))
Все истины, которые я хочу вам изложить, — бесстыдная ложь. Сделать всё хорошо
TLG: @Beliyadm
*

Protegon

  • Осваиваюсь на форуме
  • 11
  • 0 / 0
Re: Логин вместо имени
« Ответ #20 : 20.07.2009, 07:19:50 »
hi beliyadm

well, i have another doubt

how to show the    number of articles published by a user?

Example: Europa32: 50 posts

Using the normal articles.

Thank you
*

beliyadm

  • Легенда
  • 9758
  • 1664 / 66
  • Севастополь, Россия
Re: Логин вместо имени
« Ответ #21 : 20.07.2009, 14:54:03 »
Hi, give direction in action
Код: php
$query = 'SELECT a.*, u.id AS userid, u.name AS author, u.usertype, cc.title AS category, s.title AS section,' .
userid ID user from table #__users
Next write sql query (example - in tmpl file)
Код: php
$query = "SELECT count (*) AS userCountArticle FROM #__content WHERE created_by = '$this->item->userid' ";
$db->setQuery($query);
$row = $db->loadObject();
And in template insert like
Код: php
echo $row->userCountArticle;
<?php
Код: php
echo $this->article->article_username.': '.$row->userCountArticle.' posts';
Europa32: 50 posts

   
Of course, you can do COUNT(*) function in general request, but for illustration I made the outside
Все истины, которые я хочу вам изложить, — бесстыдная ложь. Сделать всё хорошо
TLG: @Beliyadm
*

Protegon

  • Осваиваюсь на форуме
  • 11
  • 0 / 0
Re: Логин вместо имени
« Ответ #22 : 20.07.2009, 17:08:36 »
Is correct the code count everything posts


51 messajes, but isn't europa user :P

 *DRINK* Thanks!

Excuse me, but i learning, and i have this code, but, i need another "WHERE" :

Код: php

// Make a MySQL Connection
// Construct our join query
$query = "SELECT jos_users.id, jos_comprofiler.avatar ".
 "FROM jos_users, jos_comprofiler ".
"WHERE jos_users.id = jos_comprofiler.id and jos_comprofiler.id= 62";

$result = mysql_query($query) or die(mysql_error());


// Print out the contents of each row into a table
while($row = mysql_fetch_array($result)){
echo $row['id']. " - ". $row['avatar'];
echo "<br />";
}


In that code i have this:

Код: php
"WHERE jos_users.id = jos_comprofiler.id and jos_comprofiler.id= 62";

but i need another WHERE to place jos_users.username= Protegon, like this

Код: php
"WHERE jos_users.id = jos_comprofiler.id and jos_comprofiler.id= 62 and  jos_users.username= Protegon";

but... not is good that code, can do you help me another time with this issue, is very difficult the mysql but i want give your thanks for all your help men.

You are genius, in the english forums is impossible find help like this, thank you
*

beliyadm

  • Легенда
  • 9758
  • 1664 / 66
  • Севастополь, Россия
Re: Логин вместо имени
« Ответ #23 : 20.07.2009, 17:16:21 »
Protegon - I was confused in your code
Why you use the mysql_query and mysql_fetch_array, but not Joomla API http://docs.joomla.org/Tutorial:How_to_use_the_database_classes_in_your_script?
I need view all you code (model and tmpl files)
If you need show user name, avatars (from CB) and counter user's articles - this better made by content plugin and not clutter the code.
Plugin find the ID current article, next SQL query by 1 query find all needed params and show.
This job for 1-2 hour, if interesting - skype or gmail jabber sent privat messg
Все истины, которые я хочу вам изложить, — бесстыдная ложь. Сделать всё хорошо
TLG: @Beliyadm
*

Protegon

  • Осваиваюсь на форуме
  • 11
  • 0 / 0
Re: Логин вместо имени
« Ответ #24 : 20.07.2009, 17:28:30 »
Because i don't know of Joomla or mysql or php or nothing, sorry but i don't know i do it xD

i want get the cb_avatar url from username

i have username, and i try get the avatar url from the username. I add you account skype men
*

beliyadm

  • Легенда
  • 9758
  • 1664 / 66
  • Севастополь, Россия
Re: Логин вместо имени
« Ответ #25 : 20.07.2009, 17:32:07 »
I add you account skype men
don't see you in skype
if needed - can write this plugin in the next few days as I will be free
Все истины, которые я хочу вам изложить, — бесстыдная ложь. Сделать всё хорошо
TLG: @Beliyadm
*

Protegon

  • Осваиваюсь на форуме
  • 11
  • 0 / 0
Re: Логин вместо имени
« Ответ #26 : 20.07.2009, 17:36:03 »
i download skype because i use msn only, but i will add you. The plugin idea is great, no    
there is a plugin for this. The plugin will let insert the avatar or another fields of community builder in the profiles. Yvcomment not have avatar plugin decent.

me too will be free in the next few days
*

Protegon

  • Осваиваюсь на форуме
  • 11
  • 0 / 0
Re: Логин вместо имени
« Ответ #27 : 02.08.2009, 20:22:55 »
Hi, i'm waiting for the plugin :p
*

Protegon

  • Осваиваюсь на форуме
  • 11
  • 0 / 0
Re: Логин вместо имени
« Ответ #28 : 10.10.2009, 12:19:38 »
hi, i think you forgive me :s
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Можно ли использовать плагин Sourcerer вместо плагина MultiAds?

Автор Briz1

Ответов: 6
Просмотров: 1635
Последний ответ 12.12.2016, 18:50:31
от effrit
Галерея sigplus, как сделать проход по ссылке при клике, вместо всплывающего окна?

Автор FliXis

Ответов: 0
Просмотров: 1228
Последний ответ 31.07.2015, 22:58:21
от FliXis
Login форма с полями почты и имени

Автор Dusk09

Ответов: 2
Просмотров: 1013
Последний ответ 23.07.2015, 11:13:28
от Dusk09
Modules Anywhere иероглифы вместо русских букв

Автор Logan09

Ответов: 1
Просмотров: 1502
Последний ответ 28.06.2014, 21:21:23
от Logan09
AcyMailing: возможно ли вместо вводного текста сделать видео?

Автор AlteTraum

Ответов: 0
Просмотров: 1080
Последний ответ 26.05.2014, 17:27:05
от AlteTraum