By Albert on Friday, 28 July 2017
Replies 5
Likes 0
Views 1.7K
Votes 0
I added a button "New Post" in the blog category to add posts to this category. (http://onlytest.ru/1-categories-blog)
But I set a condition that it appeared only for those who can create command blogs.
/components/com_easyblog/themes/wireframe/blogs/categories/item.php


<?php if ($this->acl->get('create_team_blog')) { ?>
<a href="/blog/composer?category=&lt;?php_echo_$category-=&gt;id;_?=&gt;=" class="btn btn-primary">
<?php echo JText::_('COM_EASYBLOG_NEW_POST'); ?></a>
<?php } ?>


How to write a condition that whether there was a check the user has the right to create posts in this category of the blog.
Hi Albert,

Perhaps, you can try the code below:

$id = $this->input->get('id', 0, 'int');
$category = EB::table('Category');
$category->load($id);
$model = EB::model('Category');
$allowCat = $model->allowAclCategory($category->id);

with this condition

<?php if ($category->private == 2 && !$allowCat) { ?>


*I've move this ticket to the proper category Tutorial
·
Friday, 28 July 2017 11:06
·
0 Likes
·
0 Votes
·
0 Comments
·
I do not understand which files to paste these codes

\components\com_easyblog\views\categories\view.html.php
·
Friday, 28 July 2017 13:25
·
0 Likes
·
0 Votes
·
0 Comments
·
You can put the code in the same file that you want the button 'new post' to be displays.
In your case, perhaps you can try to add it in the file:
.../components/com_easyblog/themes/wireframe/blogs/categories/item.php
and make some tweak in your condition earlier
·
Friday, 28 July 2017 16:32
·
0 Likes
·
0 Votes
·
0 Comments
·
Do I understand correctly:

In the file: .../components/com_easyblog/themes/wireframe/blogs/categories/item.php
insert code - <?php if ($category->private == 2 && !$allowCat) { ?>

In the file: ..../components/com_easyblog/views/categories/view.html.php
insert code -
$id = $this->input->get('id', 0, 'int');
$category = EB::table('Category');
$category->load($id);
$model = EB::model('Category');
$allowCat = $model->allowAclCategory($category->id);
·
Friday, 28 July 2017 17:09
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post