Forum Activity for @paul

paul
@paul
09/12/16 05:24:10AM
4,335 posts

Is it possible in Site Builder how do I show the latest images posted OR commented on?


Using Jamroom

Another option would be to list comments but search only for comments on Gallery items. The gallery _item_id would be returned as 'comment_item_id' and that could be used in some custom template code (added to the list widget) to show the image.
paul
@paul
09/11/16 12:01:07PM
4,335 posts

Creating a module to change from the Follow model to the Friend model


Jamroom Developers

Yep - That tool will make sure everyone is set to approve followers to start with.
So you're ok with the way it works now? The follower will get an email when he/she has been approved so there's no need for anything else to happen imo.
paul
@paul
09/11/16 08:36:54AM
4,335 posts

Creating a module to change from the Follow model to the Friend model


Jamroom Developers

Quote: follow approve means that all followers request need to be approved right? are you doing this in case someone has unchecked that option in their profile and they would skip by the Friend module? Or another reason I don't see?
Yes - Its sets all profiles to have to approve followers. They can subsequently turn that off, of course, but if the do, this module will not kick in and anyone who follows them will be a 'follower' and not a 'friend' (ie. no reciprocation).
Cheers
Pa
paul
@paul
09/11/16 04:21:32AM
4,335 posts

Creating a module to change from the Follow model to the Friend model


Jamroom Developers

PS - Have moved this thread to the 'developers' forum.

General question to all - Would anyone else be interested in this module? If so, we could get it released officially.
paul
@paul
09/11/16 04:17:35AM
4,335 posts

Creating a module to change from the Follow model to the Friend model


Jamroom Developers

OK - Here is my include.php file -

<?php
/**
 * @copyright 2016 Talldude Networks, LLC.
 */

// make sure we are not being called directly
defined('APP_DIR') or exit();

/**
 * meta
 */
function jrFriend_meta(){
    $_tmp = array(
        'name'        => 'Followers to Friends',
        'url'         => 'friend',
        'version'     => '0.0.1',
        'developer'   => 'The Jamroom Network, ©' . strftime('%Y'),
        'description' => 'A listener module. Upon follower acceptence, it reciprocates the follow.',
        'category'    => 'custom',
        'requires'    => 'jrFollower',
        'license'     => 'jcl'
    );
    return $_tmp;
}

/**
 * init
 */
function jrFriend_init(){
    // Update Item listener
    jrCore_register_event_listener('jrCore', 'db_update_item', 'jrFriend_db_update_item_listener');

    // Create Item listener
    jrCore_register_event_listener('jrCore', 'db_create_item', 'jrFriend_db_create_item_listener');

    // Register our friend tools
    jrCore_register_module_feature('jrCore', 'tool_view', 'jrFriend', 'approve_set', array('Set Approval', 'Set all site profiles to \'Follower Approve\''));

    return true;
}

//----------------------
// EVENT LISTENERS
//----------------------

/**
 * Update item listener
 * @param $_data array incoming data array of item including original owner profile and user IDs
 * @param $_user array current user info
 * @param $_conf array Global config
 * @param $_args array of new owner profile and user IDs
 * @param $event string Event Trigger name
 * @return array
 */
function jrFriend_db_update_item_listener($_data, $_user, $_conf, $_args, $event)
{ if ($_args['module'] == 'jrFollower' && jrCore_checktype($_args['_item_id'], 'number_nz') && isset($_data['follow_active']) && $_data['follow_active'] == 1) { // Its a follow accept - Let's reciprocate $_rt = jrCore_db_get_item('jrFollower', $_args['_item_id'], true); $_tmp = array( 'follow_active' => 1, 'follow_profile_id' => $_rt['_profile_id'] ); jrCore_db_create_item('jrFollower', $_tmp); } return $_data; } /** * Create item listener * @param $_data array incoming data array of item including original owner profile and user IDs * @param $_user array current user info * @param $_conf array Global config * @param $_args array of new owner profile and user IDs * @param $event string Event Trigger name * @return array */ function jrFriend_db_create_item_listener($_data, $_user, $_conf, $_args, $event)
{ if ($_args['module'] == 'jrProfile' && jrCore_checktype($_args['_item_id'], 'number_nz')) { // Its a profile creation - set follower approve to 'on' $_data['profile_jrFollower_approve'] = 'on'; } return $_data; }
Note that there is a second listener for 'db_create_item'. This looks for new profiles being created and sets the 'follow approve' to 'on' by default.
Also note that there is also a module tool to set all site profiles to follower approve regardless. The code for that tool is in the index.php file below -

<?php
/**
 * @copyright 2016 Talldude Networks, LLC.
 */

// make sure we are not being called directly
defined('APP_DIR') or exit();

//------------------------------
// approve_set
//------------------------------
function view_jrFriend_approve_set($_post, &$_user, &$_conf)
{ jrUser_master_only(); jrCore_page_include_admin_menu(); jrCore_page_admin_tabs('jrFriend'); jrCore_page_banner('Set Follower Approval'); // Form init $_tmp = array( 'submit_value' => 'Set Approvals', 'cancel' => "{$_conf['jrCore_base_url']}/{$_post['module_url']}/admin/tools", 'submit_prompt' => 'Are you sure you want to set all your profiles to Follower Approve?', 'submit_modal' => 'update', 'modal_width' => 800, 'modal_height' => 400, 'modal_note' => 'Please be patient whilst group discussions are alternatively imported' ); jrCore_form_create($_tmp); $_tmp = array( 'name' => 'dummy', 'value' => 'off', 'type' => 'hidden' ); jrCore_form_field_create($_tmp); jrCore_page_display(); } //------------------------------ // approve_set //------------------------------ function view_jrFriend_approve_set_save($_post, &$_user, &$_conf)
{ jrUser_master_only(); jrCore_form_validate($_post); // How many profiles are in the system? $pcnt = jrCore_db_get_datastore_item_count('jrProfile'); jrCore_form_modal_notice('update', "Setting {$pcnt} profiles to 'Follower Approve'"); // Get all their IDs $_s = array( 'return_item_id_only' => true, 'limit' => $pcnt ); $_rt = jrCore_db_search_items('jrProfile', $_s); if ($_rt && is_array($_rt) && count($_rt) > 0) { $_tmp = array(); foreach ($_rt as $rt) { $_tmp["{$rt}"] = array('profile_jrFollower_approve' => 'on'); } jrCore_db_update_multiple_items('jrProfile', $_tmp); } else { jrCore_form_modal_notice('update', "Error: Profiles not found"); } jrCore_form_modal_notice('complete', "Done"); jrCore_form_result(); }

Cheers
Pa
updated by @paul: 09/11/16 04:23:49AM
paul
@paul
09/11/16 01:18:58AM
4,335 posts

Creating a module to change from the Follow model to the Friend model


Jamroom Developers

To see the values of php variables when developing a module, use 'fdebug'. This will dump the values into the debug log which you can view in your ACP=>Dashboard=>Activity Log=>Debug Log
So whenever I develop a module listener I always start with this code -

function xxModule_my_listener($_data, $_user, $_conf, $_args, $event)
{ fdebug($_data, $_args); return $_data; }
That way, I can see all the variables I have to play with in the function.

You're doing well so far. Please carry on. Its good to nurture potential Jamroom developers :-)
If I have a bit of time later today I will try coding this listener and post my version here so that you can compare things.
Cheers
Pa
paul
@paul
09/11/16 01:07:28AM
4,335 posts

2 Suggestions for Jamroom to woo Ning creators


Ning To Jamroom

Hi Elise - Thanks for the suggestions. Up until fairly recently we did offer a 14 day free hosting trial, but it wasn't effective.
The free trial is there for anyone to try Jamroom out with and if they are going to turn into a customer, that happens within the first couple of days. A 14 day free trial just allows non-interested users longer to forget to delete their server until they get the email at the end of the trial period, so their free trial has now cost us twice as much!!
Our server costs are proportional to server size, so if we were to offer ningsters what you suggest, which is in effect a free first month of hosting, but their Ning site is 100s of Gs in size, we could be seriously out of pocket !!
paul
@paul
09/10/16 11:50:29AM
4,335 posts

Creating a module to change from the Follow model to the Friend model


Jamroom Developers

It should show up in the designated category, providing you have built the meta and init functions correctly.
You should be able to do this with just an include.php file with the above functions and the listener function in that. Paste it here if you want so that we can check it over.
paul
@paul
09/10/16 10:45:20AM
4,335 posts

Creating a module to change from the Follow model to the Friend model


Jamroom Developers

Datastore events are common to all modules so listed in the Core module Info tab.
The actual 'update' that you are listening and filtering for occurs in the jrFollower module index.php script, in function 'view_jrFollower_approve' at about line 300
(Be sure not to edit or change anything when looking at these module php scripts as things easily break!!)
  197