I am new to the ‘Ultimate Member’ plugin and I am using the ‘UM Followers’ extension plugin.
My users can all generate posts (post type).
I would like to set up a page-template in which the current logged in user can see a list of all posts sorted by most recent, only by users that he/she follows.
I had a look at the following template that generates a list of users using their avatars. But can’t figure out how I could use this to generate the list of posts by users my logged in user follows.
Guest, we are pleased to inform you that Forum Promotion has been integrated with Discord. This means no matter where you are. You will always stay connected to Forum Promotion. You can connect your Discord account by going to your account settings > connected-accounts or by Clicking here.
Once your account is connected, you will automatically join our server (if you have already joined, you will be automatically roled). You will automatically be given the role of “Approved Users.” And whenever a thread/post is created, a message will be posted in #new-threads and #new-posts.
I’m writing a code where a class member, if != -1, set its own position at array. If the value is == -1, the next free index (whose range is 0 too array’s length) is used. In this review, I’m more interested in the algorithm, making it faster, accurate and readable than anything else. despite I’m using C#, I’d like to keep it simple, C-like and avoid C#’s stuff like Linq, etc. If there’s a readable and faster way to do that without the valueSet flag, would be nice. I just added it because after the swap() call, the swapped elements would be visited twice, with value != -1, making it to be set again, wrongly. Let me know if there’s anything that’s not clear. Below the code with some functions that acts like unittests. Complete different ways to do that are also very welcome.
using System.Collections.Generic;
using System.Diagnostics;
namespace sort
{
class Program
{
static void Main(string() args)
{
t1();
t2();
t3();
t4();
}
//test case 1
static void t1()
{
var arr = new List<A>();
arr.Add(new A(-1, "a"));
arr.Add(new A(-1, "b"));
arr.Add(new A(0, "c"));
arr.Add(new A(-1, "d"));
var sortedArr = doSort(arr.ToArray());
Debug.Assert(isSorted(sortedArr));
}
// test case 2
static void t2()
{
var arr = new List<A>();
arr.Add(new A(-1, "a"));
arr.Add(new A(-1, "b"));
arr.Add(new A(-1, "c"));
arr.Add(new A(-1, "d"));
var sortedArr = doSort(arr.ToArray());
Debug.Assert(isSorted(sortedArr));
}
// test case 3
static void t3()
{
var arr = new List<A>();
arr.Add(new A(0, "a"));
arr.Add(new A(1, "b"));
arr.Add(new A(2, "c"));
arr.Add(new A(3, "d"));
var sortedArr = doSort(arr.ToArray());
Debug.Assert(isSorted(arr.ToArray()));
}
static void t4()
{
var arr = new List<A>();
arr.Add(new A(-1, "a"));
arr.Add(new A(1, "b"));
arr.Add(new A(0, "c"));
arr.Add(new A(-1, "d"));
var sortedArr = doSort(arr.ToArray());
Debug.Assert(isSorted(sortedArr));
}
// not meant to be very fast just to be used in the "unittest"
static bool isSorted(A() arr)
{
if(arr.Length == 0)
{
return false;
}
// this make sure the values is sequential, starting with 0
// and the last value must be same value as array's length
if(arr(0).index != 0 || arr(arr.Length - 1).index != arr.Length - 1)
{
return false;
}
// we have checked already if the first and last values
// are sequential, no need to recheck here so
// we loop from 1 to arr.length - 1
for (int i = 1; i < arr.Length - 1; i++)
{
if(i + 1 > arr.Length &&
arr(i).index + 1 != arr(i + 1).index)
{
return false;
}
}
return true;
}
static A() doSort(A() arr)
{
for(int i = 0; i < arr.Length; i++)
{
initValue(arr, i);
}
return arr;
}
static void initValue(A() arr, int i)
{
var e = arr(i);
if(e.valueSet)
{
return; /* nothing to do, value initialized already */
}
// initialize to current index
if(e.index == -1)
{
e.index = i;
}
// an explicit index was set, the value at i index
// must be set to the value at e.index index
else if(e.index != i)
{
swap(arr, i, e.index);
// after the swap, that element may be left
// unitialized. Do initialize now.
initValue(arr, i);
}
e.valueSet = true;
}
static void swap(A() arr, int i, int j)
{
// swap items
var t = arr(i);
arr(i) = arr(j);
arr(j) = t;
// update indexes
arr(i).index = i;
arr(j).index = j;
}
}
class A
{
public A(int i, string s)
{
index = i;
value = s;
}
public override string ToString()
{
return string.Format("index = %d, value = %s", index, value);
}
public int index { get; set; }
public string value { get; set; }
public bool valueSet { get; set; }
}
}
This add-on gives your members the ability to delete their own accounts.
You have the option of setting a ‘cool down period’, during which time access to the board is restricted to a notice that their account is scheduled for deletion – they can cancel deletion before the cool down period ends.
Users are logged out when requesting deletion, and an email confirming them of their decision is sent.
i need a Webform that send a email to group of users, which have the same interests. I use “Groups” (not organic groups, because of Drupal9) for that, so the users can decide themself to join or not.
With Webform it is possible to mail to a role of users, but not for groups. Is there a little chance, that i can select only the email-adresses from users with a special flag, like an extra field, or membership in a group ?