Opened 6 years ago

Closed 6 years ago

#1705 closed new feature (fixed)

New admin action: massmail a random selection of n users

Reported by: sitarane Owned by: planetcruiser
Priority: critical Milestone: 1.0
Component: BW Mail Keywords: massmail, random, selection, voting
Cc: jsfan

Description

Admin inputs number n, a page returns a list of n users picked randomly. They can then send the same private message (massmail) to this list.

Additional filter such as "only pick from active members" would be nice. "active user" is an already existing filter for the member search.

This is necessary for the decision system in BW to become active. This decision system has been conceived by the community and approved by BV.

Change History (11)

comment:1 Changed 6 years ago by mahouni

Has anyone started working on this? I would suggest to maybe add the following function (UNTESTED) to member.entity.php? It would return an array of random members entities (default 100), who have status active and have logged in at least once in the last year. The returned array could be sent to the admin massmail handling.

I have read that RAND() is not a very fast SQL method, but I think for this task it would be okay?

     /**
     * returns array of random (active) member entities, 
     *
     * @param int $limit - number of members to find, default 100
     * @access public
     * @return object
     */
    public function findRandomMembers($limit = 100)
    {
        if (!$this->isLoaded() && !$this->hasRole('Admin'))
        {
            return false;
        }
        $where = "DATEDIFF(NOW(), {$this->_table_name}.LastLogin) < 360";
        $where .= " AND {$this->_table_name}.Status = 'Active'";
        $where .= " ORDER BY RAND()";
        
        if ($limit)
        {
            $where .= " LIMIT {$this->dao->escape(intval($limit))}";
        }
        
        return $this->findByWhereMany($where);
        
    }

In the controller or model we would need to create a member entity from the logged in admin to call findRandomMembers().

Last edited 6 years ago by mahouni (previous) (diff)

comment:2 Changed 6 years ago by jsfan

Looks ok to me overall.However, this still needs a frontend to drive it which should probably be stting in build/admin...

comment:3 Changed 6 years ago by TimLoal

  • Component changed from unknown to BW Mail
  • Priority changed from major to critical

comment:4 Changed 6 years ago by globetrotter_tt

Probably for a quick and dirty solution we need to include this in the current used bw/admin/adminmassmail.php which is unfortunately not part of the rox framework.

comment:5 Changed 6 years ago by globetrotter_tt

  • Milestone changed from Future to 1.1
  • Owner set to globetrotter_tt
  • Status changed from new to assigned

comment:6 Changed 6 years ago by globetrotter_tt

  • Milestone changed from 1.1 to 1.0

comment:7 Changed 6 years ago by crumbking

globi do you need help here?

We could meet up in IRC and hack together ...

comment:8 Changed 6 years ago by globetrotter_tt

crumbking, feel free to reassign. i got stuck here and won't have much time this week.

comment:9 Changed 6 years ago by globetrotter_tt

  • Owner changed from globetrotter_tt to planetcruiser

comment:10 Changed 6 years ago by planetcruiser

trying to solve this today :)

comment:11 Changed 6 years ago by planetcruiser

  • Resolution set to fixed
  • Status changed from assigned to closed

i went for extending the admin mass mail tool, because i think it's not quick and dirty, but the right place for this, isn't it?

fixed via:

deployed and tested (via "test" function in admin mass mail tool) on alpha. if anyone else wants to test, go ahead. closing for now

Note: See TracTickets for help on using tickets.