We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15083
    • 697 Posts
    Quote from: AHHP at Aug 13, 2009, 06:24 AM

    Send email to members of a webgroup or all webusers.
    <?php
    $groupname = $cake->escape($_GET['groupname']);
    $members = $cake->getWebgroupMembers($groupname);
    $where = empty($members) ? '' : 'internalKey IN('. join(',', $members) .')';
    $emails = $cake->getUserField(0, 'email', 'web_user_attributes', $where);
    $result = $cake->sendMail($emails, 'Newsletter', 'Message....');
    return ($result ? 'Message sent' : 'Sending failed!');


    You read my mind, this is just what I was looking for!!!
    TY v much!
      • 10152
      • 156 Posts
      Should the class be located in manager/includes/extenders or somewhere to be automatically included ? If not possible where should I put it ? thanks wink
        • 33992 ☆ A M B ☆
        • 455 Posts
        Quote from: French at Oct 01, 2009, 12:46 PM

        Should the class be located in manager/includes/extenders or somewhere to be automatically included ? If not possible where should I put it ? thanks wink
        You should include the class in your scripts, so you would place it anywhere you like....
          God loves me. 【ツ】


          MODX.ir (Persian Support)

          Boplo.ir/modx/ (Persian)
          • 18190
          • 5 Posts
          Hi,

          First, thanks AHHP for this class. I’m a fan grin

          I think I found a bug in the [tt]updateTV($tv, $docId, $value)[/tt] function.
          It replaces all TV values in the table instead of updating the specified one... Lost a lot of data on this one.

          Line 384 is
          if( ! $id = $this->db->update($update, $this->getFullTableName('site_tmplvar_contentvalues')) )


          but it should be
          if( ! $id = $this->db->update($update, $this->getFullTableName('site_tmplvar_contentvalues'), 'contentid='.$docId) )


          Manu
            • 33992 ☆ A M B ☆
            • 455 Posts
            Thank you Manu for reporting this harmful bug. I corrected that.

            The line must be:
            if( ! $id = $this->db->update($update, $this->getFullTableName('site_tmplvar_contentvalues'), "tmplvarid=$tv AND contentid=$docId") )

            (Please modify yours while using....)
              God loves me. 【ツ】


              MODX.ir (Persian Support)

              Boplo.ir/modx/ (Persian)
              • 4971
              • 964 Posts
              Thanks for the API and all your work...

              Questions...

              1) Does SetTV creates a new TV and returns a new TV ID?

              2) Does UpdateTV edits the value of the TV and returns a new TV ID, or it
              is just a typo in the function doc header?

              3) How does they deal with multiple data TVs like checkboxes or listboxes?
              The value should be a string but in those cases is better to pass an array..
              Does it only works with single string TVs?

              Thanks again...
                Website: www.mercologia.com
                MODX Revo Tutorials:  www.modxperience.com

                MODX Professional Partner
                • 33992 ☆ A M B ☆
                • 455 Posts
                1) setTV gives TV ID and document ID and a value and INSERTs a value for a TV you have been created and returns ID of inserted row.

                2) updateTV is like setTV but it UPDATEs a current row and return last effected row ID.

                3) It gets string. Checking for TV types and other process may increase code lines and i think it’s better to do by programmer. MODx coding is really easy, These APIs are shortcuts and do not some special works....


                Thanks
                AHHP

                  God loves me. 【ツ】


                  MODX.ir (Persian Support)

                  Boplo.ir/modx/ (Persian)
                  • 4971
                  • 964 Posts
                  Thanks for clarifying things AHHP.. appreciated..
                    Website: www.mercologia.com
                    MODX Revo Tutorials:  www.modxperience.com

                    MODX Professional Partner
                    • 1561
                    • 22 Posts
                    Hmmm... I’d say, this will be extremely helpful. Can’t wait to try this out.
                      An aspiring web designer & front-end web developer who is very much interested on the modern web.

                      www.andrewabogado.com
                      • 18190
                      • 5 Posts
                      Hello,

                      I think I ran into another bug... In the WHERE part of the query in the UpdateTV function, the ’tmplvarid’ is not checked. Resulting in replacement of values in all TV’s related to that content.
                      [tt]
                      function updateTV($tv, $docId, $value) {
                      if( !is_numeric($tv) ) {
                      $arr = $this->TV_name2id(array($tv));
                      $tv = (integer) $arr[$tv];
                      }

                      if( !is_numeric($tv) || $tv == 0 )
                      return false;

                      $update = array("tmplvarid" => $tv, ’contentid’ => $docId, ’value’ => $value);
                      if( ! $id = $this->db->update($update, $this->getFullTableName(’site_tmplvar_contentvalues’), ’contentid=’.$docId.’ AND tmplvarid=’.$tv) )
                      return false;

                      return $id;
                      }[/tt]