Deployed f0743ff to 5.4 with MkDocs 1.1.2 and mike 1.0.0
[GitHub/WoltLab/woltlab.github.io.git] / 5.4 / php / api / user_activity_points / index.html
index e6ccbb9fd18eadb7c70dfa16e92303ad1df6e630..26d863de9774db2b18e04703fa292579c7e9e819 100644 (file)
 <p>Users get activity points whenever they create content to award them for their contribution.
 Activity points are used to determine the rank of a user and can also be used for user conditions, for example for automatic user group assignments.</p>
 <p>To integrate activity points into your package, you have to register an object type for the defintion <code>com.woltlab.wcf.user.activityPointEvent</code> and specify a default number of points:</p>
-<div class="highlight"><pre><span></span><code><span class="nt">&lt;type&gt;</span>
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
+<span class="normal">2</span>
+<span class="normal">3</span>
+<span class="normal">4</span>
+<span class="normal">5</span></pre></div></td><td class="code"><div class="highlight"><pre><span></span><code><span class="nt">&lt;type&gt;</span>
     <span class="nt">&lt;name&gt;</span>com.example.foo.activityPointEvent.bar<span class="nt">&lt;/name&gt;</span>
     <span class="nt">&lt;definitionname&gt;</span>com.woltlab.wcf.user.activityPointEvent<span class="nt">&lt;/definitionname&gt;</span>
     <span class="nt">&lt;points&gt;</span>10<span class="nt">&lt;/points&gt;</span>
 <span class="nt">&lt;/type&gt;</span>
 </code></pre></div>
+</td></tr></table>
 <p>The number of points awarded for this type of activity point event can be changed by the administrator in the admin control panel.
 For this form and the user activity point list shown in the frontend, you have to provide the language item</p>
-<div class="highlight"><pre><span></span><code>wcf.user.activityPoint.objectType.com.example.foo.activityPointEvent.bar
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span></pre></div></td><td class="code"><div class="highlight"><pre><span></span><code>wcf.user.activityPoint.objectType.com.example.foo.activityPointEvent.bar
 </code></pre></div>
+</td></tr></table>
 <p>that contains the name of the content for which the activity points are awarded.</p>
 <p>If a relevant object is created, you have to use <code>UserActivityPointHandler::fireEvent()</code> which expects the name of the activity point event object type, the id of the object for which the points are awarded (though the object id is not used at the moment) and the user who gets the points:</p>
-<div class="highlight"><pre><span></span><code><span class="nx">UserActivityPointHandler</span><span class="o">::</span><span class="na">getInstance</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">fireEvent</span><span class="p">(</span>
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
+<span class="normal">2</span>
+<span class="normal">3</span>
+<span class="normal">4</span>
+<span class="normal">5</span></pre></div></td><td class="code"><div class="highlight"><pre><span></span><code><span class="nx">UserActivityPointHandler</span><span class="o">::</span><span class="na">getInstance</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">fireEvent</span><span class="p">(</span>
         <span class="s1">&#39;com.example.foo.activityPointEvent.bar&#39;</span><span class="p">,</span>
         <span class="nv">$bar</span><span class="o">-&gt;</span><span class="na">barID</span><span class="p">,</span>
         <span class="nv">$bar</span><span class="o">-&gt;</span><span class="na">userID</span>
 <span class="p">);</span>
 </code></pre></div>
+</td></tr></table>
 <p>To remove activity points once objects are deleted, you have to use <code>UserActivityPointHandler::removeEvents()</code> which also expects the name of the activity point event object type and additionally an array mapping the id of the user whose activity points will be reduced to the number of objects that are removed for the relevant user:</p>
-<div class="highlight"><pre><span></span><code><span class="nx">UserActivityPointHandler</span><span class="o">::</span><span class="na">getInstance</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">removeEvents</span><span class="p">(</span>
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
+<span class="normal">2</span>
+<span class="normal">3</span>
+<span class="normal">4</span>
+<span class="normal">5</span>
+<span class="normal">6</span>
+<span class="normal">7</span></pre></div></td><td class="code"><div class="highlight"><pre><span></span><code><span class="nx">UserActivityPointHandler</span><span class="o">::</span><span class="na">getInstance</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">removeEvents</span><span class="p">(</span>
         <span class="s1">&#39;com.example.foo.activityPointEvent.bar&#39;</span><span class="p">,</span>
        <span class="p">[</span>
                 <span class="mi">1</span> <span class="o">=&gt;</span> <span class="mi">1</span><span class="p">,</span> <span class="c1">// remove points for one object for user with id `1`</span>
@@ -1984,6 +2001,7 @@ For this form and the user activity point list shown in the frontend, you have t
         <span class="p">]</span>
 <span class="p">);</span>
 </code></pre></div>
+</td></tr></table>