By Dayo on Friday, 07 July 2017
Posted in Technical Issues
Replies 7
Likes 0
Views 600
Votes 0
Hello,

This is a question and feature request.

A. QUESTION
In EasyBlog admin, when you select "delete" on pending blogs, I have followed the process flow to function confirmRemovePending in view.ajax.php. Can you kindly let me know where the "return $this->ajax->resolve($output)" is executed?

Need to know where the action to remove these from the history is implemented so I can hack it to work as I need.

B. FEATURE REQUEST
See https://stackideas.com/forums/fine-tune-handling-of-rss-generated-blogs

Thanks
PS. I notice that when i reject and then delete, the entry in the feeds history table is maintained. WOuld be great to be able to delete without first rejecting which comes with the unwanted email
·
Saturday, 08 July 2017 00:21
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Dayo,

Can you please post your feature request as a separate thread under the Feature Requests area. It would be much easier for others to comment on the feature request rather than combining them into a single post.

Now back to your question,


In EasyBlog admin, when you select "delete" on pending blogs, I have followed the process flow to function confirmRemovePending in view.ajax.php. Can you kindly let me know where the "return $this->ajax->resolve($output)" is executed?

The "resolve" method is non existent and it is only collected in the ajax library (php) to be parsed to the client side (js). You can look at the magic method __call under /administrator/components/com_easyblog/includes/ajax/ajax.php

I guess you should be looking at how the output is being sent to the caller which is in the "send" method of the ajax library.
·
Saturday, 08 July 2017 11:48
·
0 Likes
·
0 Votes
·
0 Comments
·
Updated post thanks.

Will take a look at the suggested file
·
Saturday, 08 July 2017 13:39
·
0 Likes
·
0 Votes
·
0 Comments
·
Can't see anything there pointing to manipulation of the DB. Guess I need to stick with rejecting and then deleting until suggested improvements are made. Might use filter to delete emails on receipt.
·
Saturday, 08 July 2017 13:54
·
0 Likes
·
0 Votes
·
0 Comments
·
The method $this->ajax->resolve does not actually perform any queries on the database. It's only returning the output back to the scripts to render the dialog.

The real method in removing the post is in /administrator/components/com_easyblog/controllers/pending.php under the "remove" method.
·
Sunday, 09 July 2017 13:42
·
0 Likes
·
0 Votes
·
0 Comments
·
Managed to get a workable arrangement. Not as good as in my Feature Request (https://stackideas.com/forums/fine-tune-handling-of-rss-generated-blogs) which would have dealt with other use cases in a structured way but works well.

STEP 1 /joomla/administrator/components/com_easyblog/themes/default/blogs/pending/default.php

Changed

<td class="center">
<div>
<a class="btn btn-primary btn-xs" href="javascript:void(0);" data-blog-accept data-id="<?php echo $post->uid;?>">
<?php echo JText::_('COM_EASYBLOG_APPROVE_BUTTON');?>
</a>

<a class="btn btn-danger btn-xs" href="javascript:void(0);" data-blog-reject data-id="<?php echo $post->uid;?>">
<?php echo JText::_('COM_EASYBLOG_REJECT_BUTTON');?>
</a>
</div>
</td>



To

<td class="center">
<div>
<a class="btn btn-primary btn-xs" href="javascript:void(0);" data-blog-accept data-id="<?php echo $post->uid;?>">
<?php echo JText::_('COM_EASYBLOG_APPROVE_BUTTON');?>
</a>

<a class="btn btn-warning btn-xs" href="javascript:void(0);" data-blog-reject data-id="<?php echo $post->uid;?>">
<?php echo JText::_('COM_EASYBLOG_REJECT_BUTTON');?>
</a>

<a class="btn btn-danger btn-xs" href="javascript:void(0);" data-blog-remove data-id="<?php echo $post->uid;?>">
<?php echo JText::_('COM_EASYBLOG_DELETE_BUTTON');?>
</a>
</div>
</td>


STEP 2 /joomla/administrator/components/com_easyblog/themes/default/blogs/pending/default.js

Changed

$('[data-blog-reject]').on('click', function(event) {
event.stopPropagation();
var id = $(this).data('id');

reject(id);
});



To

$('[data-blog-reject]').on('click', function(event) {
event.stopPropagation();
var id = $(this).data('id');

reject(id);
});
$('[data-blog-remove]').on('click', function(event) {
event.stopPropagation();
var id = $(this).data('id');

remove(id);
});


Step 3: /joomla/administrator/components/com_easyblog/includes/post/post.php
Under "public function delete"

Changed

/**
* Deletes a post from the site
*
* @since 5.1
* @access public
*/
public function delete()



To

/**
* Deletes a post from the site
*
* @since 5.1
* @access public
*/
public function delete($deleteHistory=true)


AND

Changed

$this->deleteFeedHistory();
$this->deleteReactions();



To

if ($deleteHistory) {
$this->deleteFeedHistory();
}
$this->deleteReactions();



STEP 4 /joomla/administrator/components/com_easyblog/controllers/pending.php
Under "public function remove"

Changed

foreach ($ids as $id) {
$post = EB::post($id);
$post->delete();
}



To

foreach ($ids as $id) {
$post = EB::post($id);
$post->delete(false);
}



With those little edits, I get a "Delete" button in the pending posts page and clicking this removes the post but keeps the post history and doesn't send any emails.

Wonder whether the EB team will consider bring this into the official code. The Feature Request is a more complete solution but this will probably serve for most cases as well.
·
Saturday, 05 August 2017 19:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Dayo,

Thanks for sharing this, appreciate this very much. We'll see if we can implement https://stackideas.com/forums/fine-tune-handling-of-rss-generated-blogs in the future major release of EasyBlog as I do think that would be a much better solution.
·
Sunday, 06 August 2017 00:03
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post